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

systemd / systemd / 15232239991

24 May 2025 08:01PM UTC coverage: 72.053% (-0.02%) from 72.07%
15232239991

push

github

web-flow
docs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)

For #20929.

299160 of 415197 relevant lines covered (72.05%)

703671.29 hits per line

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

86.96
/src/shared/main-func.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdlib.h>
4
#if HAVE_VALGRIND_VALGRIND_H
5
#  include <valgrind/valgrind.h>
6
#endif
7

8
#include "sd-daemon.h"
9

10
#include "argv-util.h"
11
#include "ask-password-agent.h"
12
#include "hashmap.h"
13
#include "main-func.h"
14
#include "pager.h"
15
#include "polkit-agent.h"
16
#include "selinux-util.h"
17
#include "signal-util.h"
18
#include "string-util.h"
19

20
void main_prepare(int argc, char *argv[]) {
73,605✔
21
        assert_se(argc > 0 && !isempty(argv[0]));
73,605✔
22
        save_argc_argv(argc, argv);
73,605✔
23
}
73,605✔
24

25
void main_finalize(int r, int exit_status) {
72,983✔
26
        if (r < 0)
72,983✔
27
                (void) sd_notifyf(0, "ERRNO=%i", -r);
5,880✔
28
        (void) sd_notifyf(0, "EXIT_STATUS=%i", exit_status);
72,983✔
29
        ask_password_agent_close();
72,983✔
30
        polkit_agent_close();
72,983✔
31
        pager_close();
72,983✔
32
        mac_selinux_finish();
72,983✔
33
}
72,983✔
34

35
int raise_or_exit_status(int ret) {
6,375✔
36
        if (ret < 0)
6,375✔
37
                return EXIT_FAILURE;
38
        if (ret == 0)
2,578✔
39
                return EXIT_SUCCESS;
40
        if (!SIGNAL_VALID(ret))
×
41
                return EXIT_FAILURE;
42

43
#if HAVE_VALGRIND_VALGRIND_H
44
        /* If raise() below succeeds, the destructor cleanup_pools() in hashmap.c will never called. */
45
        if (RUNNING_ON_VALGRIND)
46
                hashmap_trim_pools();
47
#endif
48

49
        (void) raise(ret);
×
50
        /* exit with failure if raise() does not immediately abort the program. */
51
        return EXIT_FAILURE;
×
52
}
53

54
int exit_failure_if_negative(int result) {
50,123✔
55
        return result < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
50,123✔
56
}
57

58
int exit_failure_if_nonzero(int result) {
89,468✔
59
        return result < 0 ? EXIT_FAILURE : result;
89,468✔
60
}
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