summaryrefslogtreecommitdiff
path: root/coreutils/chown.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-02-26 22:47:42 +0000
committerDenis Vlasenko2007-02-26 22:47:42 +0000
commitcce38586aee7fe892ca1c837ee08a96bd3454ee9 (patch)
tree2cce1db0f921fdc3e899641dd9c59f459ce4b07d /coreutils/chown.c
parentf8ea0f3a66559a00c41fd7877bdc241973a60f8c (diff)
downloadbusybox-cce38586aee7fe892ca1c837ee08a96bd3454ee9.zip
busybox-cce38586aee7fe892ca1c837ee08a96bd3454ee9.tar.gz
start_stop_daemon: add -chuid support
Diffstat (limited to 'coreutils/chown.c')
-rw-r--r--coreutils/chown.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/coreutils/chown.c b/coreutils/chown.c
index dad5ce0..3380677 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -56,7 +56,6 @@ static int fileAction(const char *fileName, struct stat *statbuf,
int chown_main(int argc, char **argv);
int chown_main(int argc, char **argv)
{
- char *groupName;
int retval = EXIT_SUCCESS;
opt_complementary = "-2";
@@ -65,24 +64,7 @@ int chown_main(int argc, char **argv)
if (OPT_NODEREF) chown_func = lchown;
- /* First, check if there is a group name here */
- groupName = strchr(*argv, '.'); /* deprecated? */
- if (!groupName)
- groupName = strchr(*argv, ':');
- else
- *groupName = ':'; /* replace '.' with ':' */
-
- /* First, try parsing "user[:[group]]" */
- if (!groupName) { /* "user" */
- ugid.uid = get_ug_id(*argv, xuname2uid);
- } else if (groupName == *argv) { /* ":group" */
- ugid.gid = get_ug_id(groupName + 1, xgroup2gid);
- } else {
- if (!groupName[1]) /* "user:" */
- *groupName = '\0';
- if (!get_uidgid(&ugid, *argv, 1))
- bb_error_msg_and_die("unknown user/group %s", *argv);
- }
+ parse_chown_usergroup_or_die(&ugid, argv[0]);
/* Ok, ready to do the deed now */
argv++;