From a09561746f15b84da9471b5c4be74e53d19e4f3f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Oct 2015 20:07:55 +0100 Subject: [PATCH] util-lib: introduce dirent-util.[ch] for directory entry calls Also, move a couple of more path-related functions to path-util.c. --- Makefile.am | 2 + src/basic/cgroup-util.c | 1 + src/basic/conf-files.c | 1 + src/basic/copy.c | 1 + src/basic/dirent-util.c | 81 ++++++++++++ src/basic/dirent-util.h | 51 ++++++++ src/basic/fd-util.c | 1 + src/basic/fdset.c | 1 + src/basic/locale-util.c | 1 + src/basic/path-util.c | 67 ++++++++++ src/basic/path-util.h | 7 + src/basic/util.c | 121 +----------------- src/basic/util.h | 32 ----- src/bootchart/store.c | 1 + src/core/smack-setup.c | 1 + src/dbus1-generator/dbus1-generator.c | 1 + src/delta/delta.c | 1 + src/gpt-auto-generator/gpt-auto-generator.c | 1 + src/import/pull-common.c | 1 + src/journal/coredump-vacuum.c | 1 + src/journal/coredump.c | 1 + src/journal/journal-vacuum.c | 1 + src/journal/journald-server.c | 1 + src/journal/journald-stream.c | 1 + src/journal/sd-journal.c | 1 + src/libsystemd/sd-device/device-enumerator.c | 1 + src/libsystemd/sd-login/sd-login.c | 1 + src/login/logind-acl.c | 1 + src/login/logind-dbus.c | 1 + src/login/logind.c | 1 + src/machine/machined.c | 1 + src/shared/clean-ipc.c | 1 + src/shared/efivars.c | 1 + src/shared/install.c | 5 +- src/shared/machine-image.c | 1 + src/test/test-cgroup-util.c | 1 + .../tty-ask-password-agent.c | 1 + 37 files changed, 241 insertions(+), 154 deletions(-) create mode 100644 src/basic/dirent-util.c create mode 100644 src/basic/dirent-util.h diff --git a/Makefile.am b/Makefile.am index efd1329adef..563e2cc4eab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -793,6 +793,8 @@ libbasic_la_SOURCES = \ src/basic/user-util.h \ src/basic/rlimit-util.c \ src/basic/rlimit-util.h \ + src/basic/dirent-util.c \ + src/basic/dirent-util.h \ src/basic/mount-util.c \ src/basic/mount-util.h \ src/basic/hexdecoct.c \ diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 232d6e8fe24..67dc2911921 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -30,6 +30,7 @@ #include #include "cgroup-util.h" +#include "dirent-util.h" #include "extract-word.h" #include "fd-util.h" #include "fileio.h" diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c index 3af3fe392cc..be9972fffff 100644 --- a/src/basic/conf-files.c +++ b/src/basic/conf-files.c @@ -26,6 +26,7 @@ #include #include "conf-files.h" +#include "dirent-util.h" #include "fd-util.h" #include "hashmap.h" #include "log.h" diff --git a/src/basic/copy.c b/src/basic/copy.c index 4b410a74e50..2d2d7ade348 100644 --- a/src/basic/copy.c +++ b/src/basic/copy.c @@ -24,6 +24,7 @@ #include "btrfs-util.h" #include "copy.h" +#include "dirent-util.h" #include "fd-util.h" #include "fileio.h" #include "io-util.h" diff --git a/src/basic/dirent-util.c b/src/basic/dirent-util.c new file mode 100644 index 00000000000..c433d5844aa --- /dev/null +++ b/src/basic/dirent-util.c @@ -0,0 +1,81 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2010-2012 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include +#include +#include +#include + +#include "dirent-util.h" +#include "string-util.h" + +int dirent_ensure_type(DIR *d, struct dirent *de) { + struct stat st; + + assert(d); + assert(de); + + if (de->d_type != DT_UNKNOWN) + return 0; + + if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) + return -errno; + + de->d_type = + S_ISREG(st.st_mode) ? DT_REG : + S_ISDIR(st.st_mode) ? DT_DIR : + S_ISLNK(st.st_mode) ? DT_LNK : + S_ISFIFO(st.st_mode) ? DT_FIFO : + S_ISSOCK(st.st_mode) ? DT_SOCK : + S_ISCHR(st.st_mode) ? DT_CHR : + S_ISBLK(st.st_mode) ? DT_BLK : + DT_UNKNOWN; + + return 0; +} + +bool dirent_is_file(const struct dirent *de) { + assert(de); + + if (hidden_file(de->d_name)) + return false; + + if (de->d_type != DT_REG && + de->d_type != DT_LNK && + de->d_type != DT_UNKNOWN) + return false; + + return true; +} + +bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) { + assert(de); + + if (de->d_type != DT_REG && + de->d_type != DT_LNK && + de->d_type != DT_UNKNOWN) + return false; + + if (hidden_file_allow_backup(de->d_name)) + return false; + + return endswith(de->d_name, suffix); +} diff --git a/src/basic/dirent-util.h b/src/basic/dirent-util.h new file mode 100644 index 00000000000..5866a755f4a --- /dev/null +++ b/src/basic/dirent-util.h @@ -0,0 +1,51 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2010 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include + +#include "path-util.h" + +int dirent_ensure_type(DIR *d, struct dirent *de); + +bool dirent_is_file(const struct dirent *de) _pure_; +bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; + +#define FOREACH_DIRENT(de, d, on_error) \ + for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ + if (!de) { \ + if (errno > 0) { \ + on_error; \ + } \ + break; \ + } else if (hidden_file((de)->d_name)) \ + continue; \ + else + +#define FOREACH_DIRENT_ALL(de, d, on_error) \ + for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ + if (!de) { \ + if (errno > 0) { \ + on_error; \ + } \ + break; \ + } else diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 76d7e32bfa1..f40365ce970 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -22,6 +22,7 @@ #include "fd-util.h" #include "parse-util.h" #include "util.h" +#include "dirent-util.h" int close_nointr(int fd) { assert(fd >= 0); diff --git a/src/basic/fdset.c b/src/basic/fdset.c index ef60f664313..4b11e4ea092 100644 --- a/src/basic/fdset.c +++ b/src/basic/fdset.c @@ -25,6 +25,7 @@ #include "sd-daemon.h" +#include "dirent-util.h" #include "fd-util.h" #include "fdset.h" #include "macro.h" diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index ccbc1479316..08da4b98c54 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -21,6 +21,7 @@ #include +#include "dirent-util.h" #include "fd-util.h" #include "locale-util.h" #include "path-util.h" diff --git a/src/basic/path-util.c b/src/basic/path-util.c index d581f85707d..ed30c3d92dd 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -766,3 +766,70 @@ bool path_is_safe(const char *p) { return true; } + +char *file_in_same_dir(const char *path, const char *filename) { + char *e, *ret; + size_t k; + + assert(path); + assert(filename); + + /* This removes the last component of path and appends + * filename, unless the latter is absolute anyway or the + * former isn't */ + + if (path_is_absolute(filename)) + return strdup(filename); + + e = strrchr(path, '/'); + if (!e) + return strdup(filename); + + k = strlen(filename); + ret = new(char, (e + 1 - path) + k + 1); + if (!ret) + return NULL; + + memcpy(mempcpy(ret, path, e + 1 - path), filename, k + 1); + return ret; +} + +bool hidden_file_allow_backup(const char *filename) { + assert(filename); + + return + filename[0] == '.' || + streq(filename, "lost+found") || + streq(filename, "aquota.user") || + streq(filename, "aquota.group") || + endswith(filename, ".rpmnew") || + endswith(filename, ".rpmsave") || + endswith(filename, ".rpmorig") || + endswith(filename, ".dpkg-old") || + endswith(filename, ".dpkg-new") || + endswith(filename, ".dpkg-tmp") || + endswith(filename, ".dpkg-dist") || + endswith(filename, ".dpkg-bak") || + endswith(filename, ".dpkg-backup") || + endswith(filename, ".dpkg-remove") || + endswith(filename, ".swp"); +} + +bool hidden_file(const char *filename) { + assert(filename); + + if (endswith(filename, "~")) + return true; + + return hidden_file_allow_backup(filename); +} + +bool is_device_path(const char *path) { + + /* Returns true on paths that refer to a device, either in + * sysfs or in /dev */ + + return + path_startswith(path, "/dev/") || + path_startswith(path, "/sys/"); +} diff --git a/src/basic/path-util.h b/src/basic/path-util.h index b2acca05fef..193bf72468d 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -105,3 +105,10 @@ char* dirname_malloc(const char *path); bool filename_is_valid(const char *p) _pure_; bool path_is_safe(const char *p) _pure_; + +char *file_in_same_dir(const char *path, const char *filename); + +bool hidden_file_allow_backup(const char *filename); +bool hidden_file(const char *filename) _pure_; + +bool is_device_path(const char *path); diff --git a/src/basic/util.c b/src/basic/util.c index 121ca3376e8..e214c6f3dc4 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -102,6 +102,7 @@ #include "utf8.h" #include "util.h" #include "virt.h" +#include "dirent-util.h" /* Put this test here for a lack of better place */ assert_cc(EAGAIN == EWOULDBLOCK); @@ -247,33 +248,6 @@ int readlink_and_canonicalize(const char *p, char **r) { return 0; } -char *file_in_same_dir(const char *path, const char *filename) { - char *e, *ret; - size_t k; - - assert(path); - assert(filename); - - /* This removes the last component of path and appends - * filename, unless the latter is absolute anyway or the - * former isn't */ - - if (path_is_absolute(filename)) - return strdup(filename); - - e = strrchr(path, '/'); - if (!e) - return strdup(filename); - - k = strlen(filename); - ret = new(char, (e + 1 - path) + k + 1); - if (!ret) - return NULL; - - memcpy(mempcpy(ret, path, e + 1 - path), filename, k + 1); - return ret; -} - int rmdir_parents(const char *path, const char *stop) { size_t l; int r = 0; @@ -320,36 +294,6 @@ int rmdir_parents(const char *path, const char *stop) { return 0; } -_pure_ static bool hidden_file_allow_backup(const char *filename) { - assert(filename); - - return - filename[0] == '.' || - streq(filename, "lost+found") || - streq(filename, "aquota.user") || - streq(filename, "aquota.group") || - endswith(filename, ".rpmnew") || - endswith(filename, ".rpmsave") || - endswith(filename, ".rpmorig") || - endswith(filename, ".dpkg-old") || - endswith(filename, ".dpkg-new") || - endswith(filename, ".dpkg-tmp") || - endswith(filename, ".dpkg-dist") || - endswith(filename, ".dpkg-bak") || - endswith(filename, ".dpkg-backup") || - endswith(filename, ".dpkg-remove") || - endswith(filename, ".swp"); -} - -bool hidden_file(const char *filename) { - assert(filename); - - if (endswith(filename, "~")) - return true; - - return hidden_file_allow_backup(filename); -} - bool fstype_is_network(const char *fstype) { static const char table[] = "afs\0" @@ -373,16 +317,6 @@ bool fstype_is_network(const char *fstype) { return nulstr_contains(table, fstype); } -bool is_device_path(const char *path) { - - /* Returns true on paths that refer to a device, either in - * sysfs or in /dev */ - - return - path_startswith(path, "/dev/") || - path_startswith(path, "/sys/"); -} - int dir_is_empty(const char *path) { _cleanup_closedir_ DIR *d; struct dirent *de; @@ -615,34 +549,6 @@ int null_or_empty_fd(int fd) { return null_or_empty(&st); } -bool dirent_is_file(const struct dirent *de) { - assert(de); - - if (hidden_file(de->d_name)) - return false; - - if (de->d_type != DT_REG && - de->d_type != DT_LNK && - de->d_type != DT_UNKNOWN) - return false; - - return true; -} - -bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) { - assert(de); - - if (de->d_type != DT_REG && - de->d_type != DT_LNK && - de->d_type != DT_UNKNOWN) - return false; - - if (hidden_file_allow_backup(de->d_name)) - return false; - - return endswith(de->d_name, suffix); -} - static int do_execute(char **directories, usec_t timeout, char *argv[]) { _cleanup_hashmap_free_free_ Hashmap *pids = NULL; _cleanup_set_free_free_ Set *seen = NULL; @@ -950,31 +856,6 @@ int glob_extend(char ***strv, const char *path) { return k; } -int dirent_ensure_type(DIR *d, struct dirent *de) { - struct stat st; - - assert(d); - assert(de); - - if (de->d_type != DT_UNKNOWN) - return 0; - - if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) - return -errno; - - de->d_type = - S_ISREG(st.st_mode) ? DT_REG : - S_ISDIR(st.st_mode) ? DT_DIR : - S_ISLNK(st.st_mode) ? DT_LNK : - S_ISFIFO(st.st_mode) ? DT_FIFO : - S_ISSOCK(st.st_mode) ? DT_SOCK : - S_ISCHR(st.st_mode) ? DT_CHR : - S_ISBLK(st.st_mode) ? DT_BLK : - DT_UNKNOWN; - - return 0; -} - int get_files_in_directory(const char *path, char ***list) { _cleanup_closedir_ DIR *d = NULL; size_t bufsize = 0, n = 0; diff --git a/src/basic/util.h b/src/basic/util.h index 6e5df014501..190d4f5edbe 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -22,7 +22,6 @@ ***/ #include -#include #include #include #include @@ -90,15 +89,8 @@ int readlink_value(const char *p, char **ret); int readlink_and_make_absolute(const char *p, char **r); int readlink_and_canonicalize(const char *p, char **r); -char *file_in_same_dir(const char *path, const char *filename); - int rmdir_parents(const char *path, const char *stop); -bool dirent_is_file(const struct dirent *de) _pure_; -bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; - -bool hidden_file(const char *filename) _pure_; - /* For basic lookup tables with strictly enumerated entries */ #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ scope const char *name##_to_string(type i) { \ @@ -157,8 +149,6 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k bool fstype_is_network(const char *fstype); -bool is_device_path(const char *path); - int dir_is_empty(const char *path); static inline int dir_is_populated(const char *path) { @@ -216,8 +206,6 @@ int socket_from_display(const char *display, char **path); int glob_exists(const char *path); int glob_extend(char ***strv, const char *path); -int dirent_ensure_type(DIR *d, struct dirent *de); - int get_files_in_directory(const char *path, char ***list); bool is_main_thread(void); @@ -332,26 +320,6 @@ const char *draw_special_char(DrawSpecialChar ch); int on_ac_power(void); -#define FOREACH_DIRENT(de, d, on_error) \ - for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ - if (!de) { \ - if (errno > 0) { \ - on_error; \ - } \ - break; \ - } else if (hidden_file((de)->d_name)) \ - continue; \ - else - -#define FOREACH_DIRENT_ALL(de, d, on_error) \ - for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \ - if (!de) { \ - if (errno > 0) { \ - on_error; \ - } \ - break; \ - } else - static inline void *mempset(void *s, int c, size_t n) { memset(s, c, n); return (uint8_t*)s + n; diff --git a/src/bootchart/store.c b/src/bootchart/store.c index 50b69637ef4..e488c94b3b9 100644 --- a/src/bootchart/store.c +++ b/src/bootchart/store.c @@ -33,6 +33,7 @@ #include "bootchart.h" #include "cgroup-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "fileio.h" #include "parse-util.h" diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c index 34df3921849..b8cb9964a6a 100644 --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c @@ -28,6 +28,7 @@ #include #include +#include "dirent-util.h" #include "fd-util.h" #include "fileio.h" #include "log.h" diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c index b9683a7ee19..66a0fe9ea22 100644 --- a/src/dbus1-generator/dbus1-generator.c +++ b/src/dbus1-generator/dbus1-generator.c @@ -23,6 +23,7 @@ #include "bus-util.h" #include "cgroup-util.h" #include "conf-parser.h" +#include "dirent-util.h" #include "fd-util.h" #include "fileio.h" #include "mkdir.h" diff --git a/src/delta/delta.c b/src/delta/delta.c index bb2e6195b98..590ab865152 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -26,6 +26,7 @@ #include #include +#include "dirent-util.h" #include "fd-util.h" #include "hashmap.h" #include "log.h" diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 6440fd654e0..f315d5ff6ec 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -29,6 +29,7 @@ #include "blkid-util.h" #include "btrfs-util.h" +#include "dirent-util.h" #include "efivars.h" #include "fd-util.h" #include "fileio.h" diff --git a/src/import/pull-common.c b/src/import/pull-common.c index 0e918d64162..17283a4a24f 100644 --- a/src/import/pull-common.c +++ b/src/import/pull-common.c @@ -24,6 +24,7 @@ #include "btrfs-util.h" #include "capability.h" #include "copy.h" +#include "dirent-util.h" #include "escape.h" #include "fd-util.h" #include "io-util.h" diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c index bad6ea42426..9635db19e19 100644 --- a/src/journal/coredump-vacuum.c +++ b/src/journal/coredump-vacuum.c @@ -22,6 +22,7 @@ #include #include "coredump-vacuum.h" +#include "dirent-util.h" #include "fd-util.h" #include "hashmap.h" #include "macro.h" diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 92f598464a3..ec57920d2e0 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -40,6 +40,7 @@ #include "conf-parser.h" #include "copy.h" #include "coredump-vacuum.h" +#include "dirent-util.h" #include "escape.h" #include "fd-util.h" #include "fileio.h" diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index 026dca49012..d3add065d27 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c @@ -25,6 +25,7 @@ #include "sd-id128.h" +#include "dirent-util.h" #include "fd-util.h" #include "journal-def.h" #include "journal-file.h" diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index f286e3030f7..6e6d9c1c4ac 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -36,6 +36,7 @@ #include "acl-util.h" #include "cgroup-util.h" #include "conf-parser.h" +#include "dirent-util.h" #include "extract-word.h" #include "fd-util.h" #include "formats-util.h" diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 6745864da11..a9c940690f7 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -29,6 +29,7 @@ #include "sd-daemon.h" #include "sd-event.h" +#include "dirent-util.h" #include "escape.h" #include "fd-util.h" #include "fileio.h" diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 9dcfc726eae..cfe1623e5bd 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -32,6 +32,7 @@ #include "catalog.h" #include "compress.h" +#include "dirent-util.h" #include "fd-util.h" #include "fileio.h" #include "formats-util.h" diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index c98053220c5..e1eb5b26b3a 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -22,6 +22,7 @@ #include "device-enumerator-private.h" #include "device-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "prioq.h" #include "set.h" diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 879838601c2..90ee2630798 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -43,6 +43,7 @@ #include "strv.h" #include "user-util.h" #include "util.h" +#include "dirent-util.h" /* Error codes: * diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c index 4d7bda3ee01..acb2bd57653 100644 --- a/src/login/logind-acl.c +++ b/src/login/logind-acl.c @@ -23,6 +23,7 @@ #include #include "acl-util.h" +#include "dirent-util.h" #include "escape.h" #include "fd-util.h" #include "formats-util.h" diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 61c2c9ba409..2fcf4900d3c 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -30,6 +30,7 @@ #include "bus-common-errors.h" #include "bus-error.h" #include "bus-util.h" +#include "dirent-util.h" #include "efivars.h" #include "escape.h" #include "fd-util.h" diff --git a/src/login/logind.c b/src/login/logind.c index 02c87ca58ed..957ea1fd7ed 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -30,6 +30,7 @@ #include "bus-error.h" #include "bus-util.h" #include "conf-parser.h" +#include "dirent-util.h" #include "fd-util.h" #include "formats-util.h" #include "logind.h" diff --git a/src/machine/machined.c b/src/machine/machined.c index fe229c88a8c..1a61da041d2 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -28,6 +28,7 @@ #include "bus-error.h" #include "bus-util.h" #include "cgroup-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "formats-util.h" #include "hostname-util.h" diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index 2be1bc3fc0b..c60f6059977 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -35,6 +35,7 @@ #include "string-util.h" #include "strv.h" #include "util.h" +#include "dirent-util.h" static int clean_sysvipc_shm(uid_t delete_uid) { _cleanup_fclose_ FILE *f = NULL; diff --git a/src/shared/efivars.c b/src/shared/efivars.c index 771bc9458c6..6e8f156a688 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -23,6 +23,7 @@ #include #include +#include "dirent-util.h" #include "efivars.h" #include "fd-util.h" #include "io-util.h" diff --git a/src/shared/install.c b/src/shared/install.c index a1720488e8d..bfafb59008e 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -27,8 +27,11 @@ #include "conf-files.h" #include "conf-parser.h" +#include "dirent-util.h" +#include "fd-util.h" #include "hashmap.h" #include "install-printf.h" +#include "install.h" #include "mkdir.h" #include "path-lookup.h" #include "path-util.h" @@ -38,8 +41,6 @@ #include "strv.h" #include "unit-name.h" #include "util.h" -#include "install.h" -#include "fd-util.h" typedef struct { OrderedHashmap *will_install; diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c index 415d939fc65..485793ed5d7 100644 --- a/src/shared/machine-image.c +++ b/src/shared/machine-image.c @@ -25,6 +25,7 @@ #include "btrfs-util.h" #include "copy.h" +#include "dirent-util.h" #include "fd-util.h" #include "machine-image.h" #include "mkdir.h" diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c index af8d478fa9e..104f6327be5 100644 --- a/src/test/test-cgroup-util.c +++ b/src/test/test-cgroup-util.c @@ -20,6 +20,7 @@ ***/ #include "cgroup-util.h" +#include "dirent-util.h" #include "fd-util.h" #include "formats-util.h" #include "parse-util.h" diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 33419f69626..a6240ae89a5 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -35,6 +35,7 @@ #include "ask-password-api.h" #include "conf-parser.h" #include "def.h" +#include "dirent-util.h" #include "fd-util.h" #include "io-util.h" #include "mkdir.h" -- 2.39.2