mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
only rename(2) after chmod(2) has succeed
report error if chmod(2) fails Reported by: jh
This commit is contained in:
parent
02c62349c9
commit
09259e6c48
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243334
|
@ -318,14 +318,10 @@ gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
|
|||
int
|
||||
gr_mkdb(void)
|
||||
{
|
||||
int ret;
|
||||
if (chmod(tempname, 0644) != 0)
|
||||
return (-1);
|
||||
|
||||
ret = rename(tempname, group_file);
|
||||
|
||||
if (ret == 0)
|
||||
chmod(group_file, 0644);
|
||||
|
||||
return (ret);
|
||||
return (rename(tempname, group_file));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue