commit:     2624a8c8a7030180f9548a6e2fba5b0a82c5f046
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Jul 28 15:41:24 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 28 15:41:24 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=2624a8c8

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 a65dbc2..94ab474 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;

Reply via email to