1 |
commit: 2624a8c8a7030180f9548a6e2fba5b0a82c5f046 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jul 28 15:41:24 2014 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 28 15:41:24 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=2624a8c8 |
7 |
|
8 |
checkpath: apply ownership to all paths given on command line |
9 |
|
10 |
The stat structure was not being initialized correctly in do_check. This |
11 |
was causing the owner adjustment to be skipped if the first path had the |
12 |
correct owner. |
13 |
|
14 |
Also, the "correcting owner" message should always be printed when the |
15 |
owner is being changed. |
16 |
|
17 |
X-Gentoo-Bug: 518042 |
18 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=518042 |
19 |
|
20 |
--- |
21 |
src/rc/checkpath.c | 4 ++-- |
22 |
1 file changed, 2 insertions(+), 2 deletions(-) |
23 |
|
24 |
diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c |
25 |
index a65dbc2..94ab474 100644 |
26 |
--- a/src/rc/checkpath.c |
27 |
+++ b/src/rc/checkpath.c |
28 |
@@ -67,6 +67,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, |
29 |
int r; |
30 |
int u; |
31 |
|
32 |
+ memset(&st, 0, sizeof(st)); |
33 |
if (stat(path, &st) || trunc) { |
34 |
if (type == inode_file) { |
35 |
einfo("%s: creating file", path); |
36 |
@@ -140,8 +141,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, |
37 |
} |
38 |
|
39 |
if (chowner && (st.st_uid != uid || st.st_gid != gid)) { |
40 |
- if (st.st_dev || st.st_ino) |
41 |
- einfo("%s: correcting owner", path); |
42 |
+ einfo("%s: correcting owner", path); |
43 |
if (chown(path, uid, gid)) { |
44 |
eerror("%s: chown: %s", applet, strerror(errno)); |
45 |
return -1; |