X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.c;h=e7ff0f8840fdbe5d85c82e0c55d0367a4833c2b7;hb=e1d758033dc7e101ab32323a0f1649d8daf56a22;hp=34e91762bc01d123499c09def03c78597020644b;hpb=dede0e335d1bf901b6ebfd774fab28928501e2fb;p=elogind.git diff --git a/src/shared/util.c b/src/shared/util.c index 34e91762b..e7ff0f884 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1440,7 +1440,7 @@ _pure_ static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) { } int close_all_fds(const int except[], unsigned n_except) { - DIR *d; + _cleanup_closedir_ DIR *d = NULL; struct dirent *de; int r = 0; @@ -1495,7 +1495,6 @@ int close_all_fds(const int except[], unsigned n_except) { } } - closedir(d); return r; } @@ -1514,6 +1513,7 @@ bool fstype_is_network(const char *fstype) { static const char table[] = "cifs\0" "smbfs\0" + "sshfs\0" "ncpfs\0" "ncp\0" "nfs\0" @@ -3612,9 +3612,6 @@ char *fstab_node_to_udev_node(const char *p) { bool tty_is_vc(const char *tty) { assert(tty); - if (startswith(tty, "/dev/")) - tty += 5; - return vtnr_from_tty(tty) >= 0; } @@ -5679,14 +5676,17 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c assert(mode); assert(_f); - if (!path_strv_canonicalize_absolute_uniq(search, root)) + if (!path_strv_resolve_uniq(search, root)) return -ENOMEM; STRV_FOREACH(i, search) { _cleanup_free_ char *p = NULL; FILE *f; - p = strjoin(*i, "/", path, NULL); + if (root) + p = strjoin(root, *i, "/", path, NULL); + else + p = strjoin(*i, "/", path, NULL); if (!p) return -ENOMEM;