From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 66E6E138010 for ; Tue, 9 Oct 2012 21:50:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D8869E01C5; Tue, 9 Oct 2012 21:50:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 54DF7E01C5 for ; Tue, 9 Oct 2012 21:50:46 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B44B933D7F2 for ; Tue, 9 Oct 2012 21:50:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 510B9E5436 for ; Tue, 9 Oct 2012 21:50:44 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1349819041.6f345abe91a57ab64a447b20b3c701d14f23ef69.WilliamH@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/checkpath.c X-VCS-Directories: src/rc/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 6f345abe91a57ab64a447b20b3c701d14f23ef69 X-VCS-Branch: master Date: Tue, 9 Oct 2012 21:50:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 44c6176d-f747-479c-a8af-9610d4557755 X-Archives-Hash: e8663d93f6babde3be431b4e9da39858 commit: 6f345abe91a57ab64a447b20b3c701d14f23ef69 Author: William Hubbs gmail com> AuthorDate: Tue Oct 9 21:44:01 2012 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue Oct 9 21:44:01 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=6f345abe checkpath: change the owner/group only when requested to do so Fix checkpath so that it only changes the owner/group if -o is on the command line. Reported-by: gentoo.org> X-Gentoo-Bug: 437560 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=437560 --- src/rc/checkpath.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c index 7ebbb64..f984da3 100644 --- a/src/rc/checkpath.c +++ b/src/rc/checkpath.c @@ -60,7 +60,8 @@ extern const char *applet; * See systemd's src/label.c:label_mkdir */ static int -do_check(char *path, uid_t uid, gid_t gid, mode_t mode, inode_t type, bool trunc) +do_check(char *path, uid_t uid, gid_t gid, mode_t mode, inode_t type, + bool trunc, bool chowner) { struct stat st; int fd, flags; @@ -139,7 +140,7 @@ do_check(char *path, uid_t uid, gid_t gid, mode_t mode, inode_t type, bool trunc } } - if (st.st_uid != uid || st.st_gid != gid) { + if (chowner && (st.st_uid != uid || st.st_gid != gid)) { if (st.st_dev || st.st_ino) einfo("%s: correcting owner", path); if (chown(path, uid, gid)) { @@ -223,6 +224,7 @@ checkpath(int argc, char **argv) inode_t type = inode_unknown; int retval = EXIT_SUCCESS; bool trunc = 0; + bool chowner = 0; while ((opt = getopt_long(argc, argv, getoptstring, longopts, (int *) 0)) != -1) @@ -247,6 +249,7 @@ checkpath(int argc, char **argv) applet, optarg); break; case 'o': + chowner = 1; if (parse_owner(&pw, &gr, optarg) != 0) eerrorx("%s: owner `%s' not found", applet, optarg); @@ -272,7 +275,7 @@ checkpath(int argc, char **argv) gid = gr->gr_gid; while (optind < argc) { - if (do_check(argv[optind], uid, gid, mode, type, trunc)) + if (do_check(argv[optind], uid, gid, mode, type, trunc, chowner)) retval = EXIT_FAILURE; optind++; }