* fish.c (fish_chown): Do nothing and return success if

getpwuid() or getgrgid() fails.
This commit is contained in:
Pavel Roskin 2001-07-09 16:15:33 +00:00
parent 78ab72b19f
commit 80f37db22b
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2001-07-09 Pavel Roskin <proski@gnu.org>
* fish.c (fish_chown): Do nothing and return success if
getpwuid() or getgrgid() fails.
2001-07-05 Pavel Roskin <proski@gnu.org> 2001-07-05 Pavel Roskin <proski@gnu.org>
* README.fish: Spelling fixes. * README.fish: Spelling fixes.

View File

@ -700,9 +700,18 @@ static int
fish_chown (vfs *me, char *path, int owner, int group) fish_chown (vfs *me, char *path, int owner, int group)
{ {
char *sowner, *sgroup; char *sowner, *sgroup;
struct passwd *pw;
struct group *gr;
PREFIX PREFIX
sowner = getpwuid( owner )->pw_name;
sgroup = getgrgid( group )->gr_name; if ((pw = getpwuid (owner)) == NULL)
return 0;
if ((gr = getgrgid (group)) == NULL)
return 0;
sowner = pw->pw_name;
sgroup = gr->gr_name;
g_snprintf(buf, sizeof(buf), g_snprintf(buf, sizeof(buf),
"#CHOWN /%s /%s\n" "#CHOWN /%s /%s\n"
"chown %s \"/%s\" 2>/dev/null\n" "chown %s \"/%s\" 2>/dev/null\n"