diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-26 16:32:40 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 2cefb09ff69c3595e98c55f0da1bd137c612276c (patch) | |
tree | 413850b2eb4d2cd031c2d31ef66b657baf5d66d4 /src/basic/stat-util.c | |
parent | 1049fbda947f856942a693f011fe013a2ee798f0 (diff) |
os-util: add helpers for finding /etc/os-release
Place this new helpers in a new source file os-util.[ch], and move the
existing and related call path_is_os_tree() to it as well.
Diffstat (limited to 'src/basic/stat-util.c')
-rw-r--r-- | src/basic/stat-util.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index a1628efd9..d88f97fdf 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -139,33 +139,7 @@ int path_is_read_only_fs(const char *path) { } #if 0 /// UNNEEDED by elogind -int path_is_os_tree(const char *path) { - int r; - - assert(path); - - /* Does the path exist at all? If not, generate an error immediately. This is useful so that a missing root dir - * always results in -ENOENT, and we can properly distuingish the case where the whole root doesn't exist from - * the case where just the os-release file is missing. */ - if (laccess(path, F_OK) < 0) - return -errno; - - /* We use /usr/lib/os-release as flag file if something is an OS */ - r = chase_symlinks("/usr/lib/os-release", path, CHASE_PREFIX_ROOT, NULL); - if (r == -ENOENT) { - - /* Also check for the old location in /etc, just in case. */ - r = chase_symlinks("/etc/os-release", path, CHASE_PREFIX_ROOT, NULL); - if (r == -ENOENT) - return 0; /* We got nothing */ - } - if (r < 0) - return r; - - return 1; -} #endif // 0 - int files_same(const char *filea, const char *fileb, int flags) { struct stat a, b; |