svn commit: r243334 - head/lib/libutil
Baptiste Daroussin
bapt at FreeBSD.org
Tue Nov 20 14:03:10 UTC 2012
Author: bapt
Date: Tue Nov 20 14:03:09 2012
New Revision: 243334
URL: http://svnweb.freebsd.org/changeset/base/243334
Log:
only rename(2) after chmod(2) has succeed
report error if chmod(2) fails
Reported by: jh
Modified:
head/lib/libutil/gr_util.c
Modified: head/lib/libutil/gr_util.c
==============================================================================
--- head/lib/libutil/gr_util.c Tue Nov 20 12:32:18 2012 (r243333)
+++ head/lib/libutil/gr_util.c Tue Nov 20 14:03:09 2012 (r243334)
@@ -318,14 +318,10 @@ gr_copy(int ffd, int tfd, const struct g
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));
}
/*
More information about the svn-src-all
mailing list