From 80f37db22bda6c7aecffb282595a010fbf582c19 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Mon, 9 Jul 2001 16:15:33 +0000 Subject: [PATCH] * fish.c (fish_chown): Do nothing and return success if getpwuid() or getgrgid() fails. --- vfs/ChangeLog | 5 +++++ vfs/fish.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 63e6c67a6..8ade02785 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +2001-07-09 Pavel Roskin + + * fish.c (fish_chown): Do nothing and return success if + getpwuid() or getgrgid() fails. + 2001-07-05 Pavel Roskin * README.fish: Spelling fixes. diff --git a/vfs/fish.c b/vfs/fish.c index f599e61ba..c5a91e049 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -700,9 +700,18 @@ static int fish_chown (vfs *me, char *path, int owner, int group) { char *sowner, *sgroup; + struct passwd *pw; + struct group *gr; 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), "#CHOWN /%s /%s\n" "chown %s \"/%s\" 2>/dev/null\n"