From 2624a8c8a7030180f9548a6e2fba5b0a82c5f046 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Mon, 28 Jul 2014 10:41:24 -0500 Subject: [PATCH] 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 --- src/rc/checkpath.c | 4 ++-- 1 file 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;