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

systemd / systemd / 15646177709

13 Jun 2025 10:59PM UTC coverage: 72.071% (+0.06%) from 72.008%
15646177709

push

github

YHNdnzj
nsresourced: make sure "tun" driver is properly loaded and accessible

We need access to /dev/net/tun, hence make sure we can actually see
/dev/. Also make sure the module is properly loaded before we operate,
given that we run with limit caps. But then again give the CAP_NET_ADMIN
cap, since we need to configure the network tap/tun devices.

Follow-up for: 136503472

300309 of 416683 relevant lines covered (72.07%)

701997.93 hits per line

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

96.36
/src/basic/ordered-set.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdio.h>
4
#include <stdlib.h>
5
#include <string.h>
6

7
#include "fileio.h"
8
#include "ordered-set.h"
9
#include "strv.h"
10

11
int ordered_set_ensure_allocated(OrderedSet **s, const struct hash_ops *ops) {
111,816✔
12
        if (*s)
111,816✔
13
                return 0;
14

15
        *s = ordered_set_new(ops);
37,992✔
16
        if (!*s)
37,992✔
17
                return -ENOMEM;
×
18

19
        return 0;
20
}
21

22
int ordered_set_ensure_put(OrderedSet **s, const struct hash_ops *ops, void *p) {
91,789✔
23
        int r;
91,789✔
24

25
        r = ordered_set_ensure_allocated(s, ops);
91,789✔
26
        if (r < 0)
91,789✔
27
                return r;
28

29
        return ordered_set_put(*s, p);
91,789✔
30
}
31

32
int ordered_set_consume(OrderedSet *s, void *p) {
3,367✔
33
        int r;
3,367✔
34

35
        r = ordered_set_put(s, p);
3,367✔
36
        if (r <= 0)
3,367✔
37
                free(p);
10✔
38

39
        return r;
3,367✔
40
}
41

42
int ordered_set_put_strdup_full(OrderedSet **s, const struct hash_ops *hash_ops, const char *p) {
1,401✔
43
        char *c;
1,401✔
44
        int r;
1,401✔
45

46
        assert(s);
1,401✔
47
        assert(p);
1,401✔
48

49
        r = ordered_set_ensure_allocated(s, hash_ops);
1,401✔
50
        if (r < 0)
1,401✔
51
                return r;
52

53
        if (ordered_set_contains(*s, p))
1,401✔
54
                return 0;
55

56
        c = strdup(p);
1,360✔
57
        if (!c)
1,360✔
58
                return -ENOMEM;
59

60
        return ordered_set_consume(*s, c);
1,360✔
61
}
62

63
int ordered_set_put_strdupv_full(OrderedSet **s, const struct hash_ops *hash_ops, char **l) {
12,004✔
64
        int n = 0, r;
12,004✔
65

66
        assert(s);
12,004✔
67

68
        STRV_FOREACH(i, l) {
12,082✔
69
                r = ordered_set_put_strdup_full(s, hash_ops, *i);
78✔
70
                if (r < 0)
78✔
71
                        return r;
72

73
                n += r;
78✔
74
        }
75

76
        return n;
77
}
78

79
int ordered_set_put_string_set_full(OrderedSet **s, const struct hash_ops *hash_ops, OrderedSet *l) {
23,965✔
80
        int n = 0, r;
23,965✔
81
        char *p;
23,965✔
82

83
        assert(s);
23,965✔
84

85
        /* Like ordered_set_put_strv, but for an OrderedSet of strings */
86

87
        ORDERED_SET_FOREACH(p, l) {
24,128✔
88
                r = ordered_set_put_strdup_full(s, hash_ops, p);
163✔
89
                if (r < 0)
163✔
90
                        return r;
×
91

92
                n += r;
163✔
93
        }
94

95
        return n;
23,965✔
96
}
97

98
void ordered_set_print(FILE *f, const char *field, OrderedSet *s) {
45,449✔
99
        bool space = false;
45,449✔
100
        char *p;
45,449✔
101

102
        assert(f);
45,449✔
103
        assert(field);
45,449✔
104

105
        if (ordered_set_isempty(s))
45,449✔
106
                return;
44,641✔
107

108
        fputs(field, f);
808✔
109

110
        ORDERED_SET_FOREACH(p, s)
2,156✔
111
                fputs_with_separator(f, p, NULL, &space);
1,348✔
112

113
        fputc('\n', f);
808✔
114
}
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