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

systemd / systemd / 25409762285

05 May 2026 08:45PM UTC coverage: 72.658% (-0.02%) from 72.674%
25409762285

push

github

web-flow
Couple of coverity fixes (#41951)

0 of 11 new or added lines in 2 files covered. (0.0%)

2705 existing lines in 63 files now uncovered.

326249 of 449021 relevant lines covered (72.66%)

1212712.0 hits per line

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

0.0
/src/report/report-basic-server.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "sd-varlink.h"
4

5
#include "ansi-color.h"
6
#include "build.h"
7
#include "format-table.h"
8
#include "log.h"
9
#include "main-func.h"
10
#include "options.h"
11
#include "report-basic.h"
12
#include "varlink-io.systemd.Metrics.h"
13
#include "varlink-util.h"
14

15
static int vl_server(void) {
×
16
        _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
×
17
        int r;
×
18

19
        r = varlink_server_new(&vs, /* flags= */ 0, /* userdata= */ NULL);
×
20
        if (r < 0)
×
21
                return log_error_errno(r, "Failed to allocate Varlink server: %m");
×
22

23
        r = sd_varlink_server_add_interface(vs, &vl_interface_io_systemd_Metrics);
×
24
        if (r < 0)
×
25
                return log_error_errno(r, "Failed to add Varlink interface: %m");
×
26

27
        r = sd_varlink_server_bind_method_many(
×
28
                        vs,
29
                        "io.systemd.Metrics.List",     vl_method_list_metrics,
30
                        "io.systemd.Metrics.Describe", vl_method_describe_metrics);
UNCOV
31
        if (r < 0)
×
UNCOV
32
                return log_error_errno(r, "Failed to bind Varlink methods: %m");
×
33

34
        r = sd_varlink_server_loop_auto(vs);
×
35
        if (r < 0)
×
36
                return log_error_errno(r, "Failed to run Varlink event loop: %m");
×
37

38
        return 0;
39
}
40

UNCOV
41
static int help(void) {
×
42
        _cleanup_(table_unrefp) Table *options = NULL;
×
UNCOV
43
        int r;
×
44

UNCOV
45
        r = option_parser_get_help_table(&options);
×
UNCOV
46
        if (r < 0)
×
47
                return r;
48

UNCOV
49
        printf("%s [OPTIONS...]\n"
×
50
               "\n%sGenerate a report describing the current system%s\n"
51
               "\n%sOptions:%s\n",
52
               program_invocation_short_name,
53
               ansi_highlight(),
54
               ansi_normal(),
55
               ansi_underline(),
56
               ansi_normal());
57

58
        return table_print_or_warn(options);
×
59
}
60

UNCOV
61
static int parse_argv(int argc, char *argv[]) {
×
62
        int r;
×
63

64
        assert(argc >= 0);
×
65
        assert(argv);
×
66

67
        OptionParser opts = { argc, argv };
×
68

UNCOV
69
        FOREACH_OPTION_OR_RETURN(c, &opts)
×
UNCOV
70
                switch (c) {
×
71
                OPTION_COMMON_HELP:
×
72
                        return help();
×
73

UNCOV
74
                OPTION_COMMON_VERSION:
×
75
                        return version();
×
76
                }
77

78
        if (opts.optind < argc)
×
79
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
×
80
                                       "This program takes no arguments.");
81

UNCOV
82
        r = sd_varlink_invocation(SD_VARLINK_ALLOW_ACCEPT);
×
UNCOV
83
        if (r < 0)
×
84
                return log_error_errno(r, "Failed to check if invoked in Varlink mode: %m");
×
85
        if (r == 0)
×
UNCOV
86
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
×
87
                                       "This program can only run as a Varlink service.");
88
        return 1;
89
}
90

UNCOV
91
static int run(int argc, char *argv[]) {
×
UNCOV
92
        int r;
×
93

UNCOV
94
        log_setup();
×
95

96
        r = parse_argv(argc, argv);
×
UNCOV
97
        if (r <= 0)
×
98
                return r;
99

UNCOV
100
        return vl_server();
×
101
}
102

UNCOV
103
DEFINE_MAIN_FUNCTION(run);
×
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