Dont change ownership unless we created the directory.

This commit is contained in:
Glenn L McGrath 2004-01-23 20:28:53 +00:00
parent 578eff5066
commit 711bb92d7c

View File

@ -80,11 +80,13 @@ extern int install_main(int argc, char **argv)
*argv_ptr = '\0'; *argv_ptr = '\0';
old_argv_ptr++; old_argv_ptr++;
} }
if ((mkdir(*argv, mode) == -1) && (errno != EEXIST)) { if (mkdir(*argv, mode) == -1) {
if (errno != EEXIST) {
bb_perror_msg("coulnt create %s", *argv); bb_perror_msg("coulnt create %s", *argv);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
break; break;
} }
}
else if (lchown(*argv, uid, gid) == -1) { else if (lchown(*argv, uid, gid) == -1) {
bb_perror_msg("cannot change ownership of %s", *argv); bb_perror_msg("cannot change ownership of %s", *argv);
ret = EXIT_FAILURE; ret = EXIT_FAILURE;