[systemd-devel] [PATCH] tmpfiles: copy - stop if chown/chmod fails
Thomas H.P. Andersen
phomes at gmail.com
Thu Jun 19 13:48:47 PDT 2014
From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
after 19f3934057d20c63f4c95791312038a41b4666d0 the errors from chown/chmod
will be cleared before being read. Presumably to clear the possible EEXIST
from copying to an existing directory.
Note: with this patch we stop immediately on error in chown/chmod while before
we would attempt to copy anyway.
---
src/shared/copy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/copy.c b/src/shared/copy.c
index 867e49b..5434e7b 100644
--- a/src/shared/copy.c
+++ b/src/shared/copy.c
@@ -181,10 +181,10 @@ static int fd_copy_directory(int df, const char *from, const struct stat *st, in
if (created) {
if (fchown(fdt, st->st_uid, st->st_gid) < 0)
- r = -errno;
+ return -errno;
if (fchmod(fdt, st->st_mode & 07777) < 0)
- r = -errno;
+ return -errno;
}
r = 0;
--
1.9.3
More information about the systemd-devel
mailing list