chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
consistently order cleanup attribute before type
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index bce4e634c23537ae7ede93520ae0898496be5d75..dbdb69270de7a7db7163397ff5df9a2e08f4ef17 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-1514,6
+1514,7
@@
bool fstype_is_network(const char *fstype) {
static const char table[] =
"cifs\0"
"smbfs\0"
static const char table[] =
"cifs\0"
"smbfs\0"
+ "sshfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"
@@
-2671,7
+2672,7
@@
finish:
}
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {
}
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {
-
DIR *d
;
+
_cleanup_closedir_ DIR *d = NULL
;
int ret = 0;
assert(fd >= 0);
int ret = 0;
assert(fd >= 0);
@@
-2694,15
+2695,12
@@
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
errno = 0;
de = readdir(d);
errno = 0;
de = readdir(d);
- if (!de
&& errno != 0
) {
- if (ret == 0)
+ if (!de) {
+ if (
errno != 0 &&
ret == 0)
ret = -errno;
ret = -errno;
-
break
;
+
return ret
;
}
}
- if (!de)
- break;
-
if (streq(de->d_name, ".") || streq(de->d_name, ".."))
continue;
if (streq(de->d_name, ".") || streq(de->d_name, ".."))
continue;
@@
-2758,10
+2756,6
@@
int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
}
}
}
}
}
}
-
- closedir(d);
-
- return ret;
}
_pure_ static int is_temporary_fs(struct statfs *s) {
}
_pure_ static int is_temporary_fs(struct statfs *s) {
@@
-3619,9
+3613,6
@@
char *fstab_node_to_udev_node(const char *p) {
bool tty_is_vc(const char *tty) {
assert(tty);
bool tty_is_vc(const char *tty) {
assert(tty);
- if (startswith(tty, "/dev/"))
- tty += 5;
-
return vtnr_from_tty(tty) >= 0;
}
return vtnr_from_tty(tty) >= 0;
}
@@
-5686,14
+5677,17
@@
static int search_and_fopen_internal(const char *path, const char *mode, const c
assert(mode);
assert(_f);
assert(mode);
assert(_f);
- if (!path_strv_
canonicalize_absolut
e_uniq(search, root))
+ if (!path_strv_
resolv
e_uniq(search, root))
return -ENOMEM;
STRV_FOREACH(i, search) {
_cleanup_free_ char *p = NULL;
FILE *f;
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;
if (!p)
return -ENOMEM;