aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2014-07-28 10:41:24 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2014-07-28 10:41:24 -0500
commit2624a8c8a7030180f9548a6e2fba5b0a82c5f046 (patch)
treeadbff75a3d7767f17caf68303ca4bd1465ab530d
parent275714bdc74c363ca1612b2b6b97f74f7a62b50c (diff)
checkpath: apply ownership to all paths given on command line
The stat structure was not being initialized correctly in do_check. This was causing the owner adjustment to be skipped if the first path had the correct owner. Also, the "correcting owner" message should always be printed when the owner is being changed. X-Gentoo-Bug: 518042 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=518042
-rw-r--r--src/rc/checkpath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c
index a65dbc2f..94ab4742 100644
--- a/src/rc/checkpath.c
+++ b/src/rc/checkpath.c
@@ -67,6 +67,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
int r;
int u;
+ memset(&st, 0, sizeof(st));
if (stat(path, &st) || trunc) {
if (type == inode_file) {
einfo("%s: creating file", path);
@@ -140,8 +141,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
}
if (chowner && (st.st_uid != uid || st.st_gid != gid)) {
- if (st.st_dev || st.st_ino)
- einfo("%s: correcting owner", path);
+ einfo("%s: correcting owner", path);
if (chown(path, uid, gid)) {
eerror("%s: chown: %s", applet, strerror(errno));
return -1;