• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 15079507752

16 May 2025 10:18PM UTC coverage: 72.276% (+0.009%) from 72.267%
15079507752

push

github

YHNdnzj
sd-bus: drop a bunch of 'else'

With the new US taxes on bits and bytes let's reduce our footprint a
bit.

11 of 19 new or added lines in 1 file covered. (57.89%)

4028 existing lines in 76 files now uncovered.

298564 of 413090 relevant lines covered (72.28%)

700985.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.27
/src/userdb/userdbd.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdlib.h>
4
#include <sys/stat.h>
5

6
#include "sd-event.h"
7

8
#include "daemon-util.h"
9
#include "log.h"
10
#include "main-func.h"
11
#include "signal-util.h"
12
#include "userdbd-manager.h"
13

14
/* This service offers two Varlink services, both implementing io.systemd.UserDatabase:
15
 *
16
 *         → io.systemd.NameServiceSwitch: this is a compatibility interface for glibc NSS: it responds to
17
 *           name lookups by checking the classic NSS interfaces and responding that.
18
 *
19
 *         → io.systemd.Multiplexer: this multiplexes lookup requests to all Varlink services that have a
20
 *           socket in /run/systemd/userdb/. It's supposed to simplify clients that don't want to implement
21
 *           the full iterative logic on their own.
22
 *
23
 *         → io.systemd.DropIn: this makes JSON user/group records dropped into /run/userdb/ available as
24
 *           regular users.
25
 */
26

27
static int run(int argc, char *argv[]) {
20✔
28
        _cleanup_(manager_freep) Manager *m = NULL;
20✔
29
        _unused_ _cleanup_(notify_on_cleanup) const char *notify_stop = NULL;
20✔
30
        int r;
20✔
31

32
        log_setup();
20✔
33

34
        umask(0022);
20✔
35

36
        if (argc != 1)
20✔
UNCOV
37
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
×
38

39
        if (setenv("SYSTEMD_BYPASS_USERDB", "io.systemd.NameServiceSwitch:io.systemd.Multiplexer:io.systemd.DropIn", 1) < 0)
20✔
UNCOV
40
                return log_error_errno(errno, "Failed to set $SYSTEMD_BYPASS_USERDB: %m");
×
41

42
        assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD) >= 0);
20✔
43

44
        r = manager_new(&m);
20✔
45
        if (r < 0)
20✔
UNCOV
46
                return log_error_errno(r, "Could not create manager: %m");
×
47

48
        r = manager_startup(m);
20✔
49
        if (r < 0)
20✔
UNCOV
50
                return log_error_errno(r, "Failed to start up daemon: %m");
×
51

52
        notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
20✔
53

54
        r = sd_event_loop(m->event);
20✔
55
        if (r < 0)
20✔
UNCOV
56
                return log_error_errno(r, "Event loop failed: %m");
×
57

58
        return 0;
59
}
60

61
DEFINE_MAIN_FUNCTION(run);
20✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc