chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
namespace: also include /root in ProtectHome=
[elogind.git]
/
src
/
tmpfiles
/
tmpfiles.c
diff --git
a/src/tmpfiles/tmpfiles.c
b/src/tmpfiles/tmpfiles.c
index 52f80379e38e86fcd203bbf1405d18f848fd46b6..04b472da97e58315769c0cb31c9323a1520f6f63 100644
(file)
--- a/
src/tmpfiles/tmpfiles.c
+++ b/
src/tmpfiles/tmpfiles.c
@@
-217,19
+217,16
@@
static bool unix_socket_alive(const char *fn) {
}
static int dir_is_mount_point(DIR *d, const char *subdir) {
}
static int dir_is_mount_point(DIR *d, const char *subdir) {
-
struct file_handle *h
;
+
union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ }
;
int mount_id_parent, mount_id;
int r_p, r;
int mount_id_parent, mount_id;
int r_p, r;
- h = alloca(MAX_HANDLE_SZ);
-
- h->handle_bytes = MAX_HANDLE_SZ;
- r_p = name_to_handle_at(dirfd(d), ".", h, &mount_id_parent, 0);
+ r_p = name_to_handle_at(dirfd(d), ".", &h.handle, &mount_id_parent, 0);
if (r_p < 0)
r_p = -errno;
if (r_p < 0)
r_p = -errno;
- h
->
handle_bytes = MAX_HANDLE_SZ;
- r = name_to_handle_at(dirfd(d), subdir,
h
, &mount_id, 0);
+ h
.handle.
handle_bytes = MAX_HANDLE_SZ;
+ r = name_to_handle_at(dirfd(d), subdir,
&h.handle
, &mount_id, 0);
if (r < 0)
r = -errno;
if (r < 0)
r = -errno;
@@
-496,7
+493,7
@@
static int write_one_file(Item *i, const char *path) {
unescaped = cunescape(i->argument);
if (unescaped == NULL) {
unescaped = cunescape(i->argument);
if (unescaped == NULL) {
-
close_nointr_nofail
(fd);
+
safe_close
(fd);
return log_oom();
}
return log_oom();
}
@@
-505,12
+502,12
@@
static int write_one_file(Item *i, const char *path) {
if (n < 0 || (size_t) n < l) {
log_error("Failed to write file %s: %s", path, n < 0 ? strerror(-n) : "Short write");
if (n < 0 || (size_t) n < l) {
log_error("Failed to write file %s: %s", path, n < 0 ? strerror(-n) : "Short write");
-
close_nointr_nofail
(fd);
+
safe_close
(fd);
return n < 0 ? n : -EIO;
}
}
return n < 0 ? n : -EIO;
}
}
-
close_nointr_nofail
(fd);
+
safe_close
(fd);
if (stat(path, &st) < 0) {
log_error("stat(%s) failed: %m", path);
if (stat(path, &st) < 0) {
log_error("stat(%s) failed: %m", path);
@@
-542,7
+539,7
@@
static int recursive_relabel_children(Item *i, const char *path) {
for (;;) {
struct dirent *de;
for (;;) {
struct dirent *de;
- bool
is_
dir;
+ bool dir;
int r;
_cleanup_free_ char *entry_path = NULL;
int r;
_cleanup_free_ char *entry_path = NULL;
@@
-567,18
+564,17
@@
static int recursive_relabel_children(Item *i, const char *path) {
}
if (de->d_type == DT_UNKNOWN) {
}
if (de->d_type == DT_UNKNOWN) {
- struct stat st;
-
- if (lstat(entry_path, &st) < 0) {
+ r = is_dir(entry_path);
+ if (r < 0) {
if (ret == 0 && errno != ENOENT)
ret = -errno;
continue;
}
if (ret == 0 && errno != ENOENT)
ret = -errno;
continue;
}
-
is_dir = S_ISDIR(st.st_mode)
;
+
dir = r
;
} else
} else
-
is_
dir = de->d_type == DT_DIR;
+ dir = de->d_type == DT_DIR;
r = item_set_perms(i, entry_path);
if (r < 0) {
r = item_set_perms(i, entry_path);
if (r < 0) {
@@
-587,7
+583,7
@@
static int recursive_relabel_children(Item *i, const char *path) {
continue;
}
continue;
}
- if (
is_
dir) {
+ if (dir) {
r = recursive_relabel_children(i, entry_path);
if (r < 0 && ret == 0)
ret = r;
r = recursive_relabel_children(i, entry_path);
if (r < 0 && ret == 0)
ret = r;