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

systemd / systemd / 21846209963

09 Feb 2026 03:52PM UTC coverage: 72.697% (-0.02%) from 72.716%
21846209963

push

github

daandemeyer
meson: guard symlinks in sysconfdir behind install_sysconfidr

Symlinks to files inside sysconfdir are now only installed if
ìnstall_sysconfdir=true (which is the default).

If sshconfdir,sshdconfdir,shellprofiledir are not inside sysconfdir and
install_sysconfidr=false, these symlinks are still installed to the
configured directory.

311951 of 429113 relevant lines covered (72.7%)

1156102.48 hits per line

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

85.11
/src/basic/dirent-util.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

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

6
#include "dirent-util.h"
7
#include "path-util.h"
8
#include "stat-util.h"
9
#include "string-util.h"
10

11
int dirent_ensure_type(int dir_fd, struct dirent *de) {
10,858,417✔
12
        int r;
10,858,417✔
13

14
        assert(dir_fd >= 0);
10,858,417✔
15
        assert(de);
10,858,417✔
16

17
        if (de->d_type != DT_UNKNOWN)
10,858,417✔
18
                return 0;
10,858,417✔
19

20
        if (dot_or_dot_dot(de->d_name)) {
2✔
21
                de->d_type = DT_DIR;
1✔
22
                return 0;
1✔
23
        }
24

25
        /* Let's ask only for the type, nothing else. */
26
        struct statx sx;
1✔
27
        r = xstatx_full(dir_fd,
1✔
28
                        de->d_name,
29
                        AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT,
30
                        /* mandatory_mask= */ STATX_TYPE,
31
                        /* optional_mask= */ STATX_INO,
32
                        /* mandatory_attributes= */ 0,
33
                        &sx);
34
        if (r < 0)
1✔
35
                return r;
36

37
        assert(FLAGS_SET(sx.stx_mask, STATX_TYPE));
×
38
        de->d_type = IFTODT(sx.stx_mode);
×
39

40
        /* If the inode is passed too, update the field, i.e. report most recent data */
41
        if (FLAGS_SET(sx.stx_mask, STATX_INO))
×
42
                de->d_ino = sx.stx_ino;
×
43

44
        return 0;
45
}
46

47
bool dirent_is_file(const struct dirent *de) {
18,359✔
48
        assert(de);
18,359✔
49

50
        if (!IN_SET(de->d_type, DT_REG, DT_LNK, DT_UNKNOWN))
18,359✔
51
                return false;
52

53
        if (hidden_or_backup_file(de->d_name))
15,385✔
54
                return false;
5✔
55

56
        return true;
57
}
58

59
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
12✔
60
        assert(de);
12✔
61

62
        if (!IN_SET(de->d_type, DT_REG, DT_LNK, DT_UNKNOWN))
12✔
63
                return false;
64

65
        if (de->d_name[0] == '.')
11✔
66
                return false;
67

68
        if (!suffix)
9✔
69
                return true;
70

71
        return endswith(de->d_name, suffix);
6✔
72
}
73

74
struct dirent* readdir_ensure_type(DIR *d) {
11,556,709✔
75
        int r;
11,556,709✔
76

77
        assert(d);
11,556,709✔
78

79
        /* Like readdir(), but fills in .d_type if it is DT_UNKNOWN */
80

81
        for (;;) {
11,556,709✔
82
                struct dirent *de;
11,556,709✔
83

84
                errno = 0;
11,556,709✔
85
                de = readdir(d);
11,556,709✔
86
                if (!de)
11,556,709✔
87
                        return NULL;
88

89
                r = dirent_ensure_type(dirfd(d), de);
10,858,087✔
90
                if (r >= 0)
10,858,087✔
91
                        return de;
92
                if (r != -ENOENT) {
×
93
                        errno = -r; /* We want to be compatible with readdir(), hence propagate error via errno here */
×
94
                        return NULL;
×
95
                }
96

97
                /* Vanished by now? Then skip immediately to next */
98
        }
99
}
100

101
struct dirent* readdir_no_dot(DIR *d) {
91,042✔
102
        assert(d);
91,042✔
103

104
        for (;;) {
118,880✔
105
                struct dirent *de;
118,880✔
106

107
                de = readdir_ensure_type(d);
118,880✔
108
                if (!de || !dot_or_dot_dot(de->d_name))
118,880✔
109
                        return de;
91,042✔
110
        }
111
}
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