diff options
author | Nate Williams <nate@FreeBSD.org> | 1998-07-16 17:18:25 +0000 |
---|---|---|
committer | Nate Williams <nate@FreeBSD.org> | 1998-07-16 17:18:25 +0000 |
commit | 73375325b1425bd849178e17c08efa05c2614f28 (patch) | |
tree | 70da59e0f36e6ac61488b4d97fd76034b4c87b65 /usr.sbin/pw/edgroup.c | |
parent | 3a4215418cab6a540bb648c570af74a475136aea (diff) | |
download | src-73375325b1425bd849178e17c08efa05c2614f28.tar.gz src-73375325b1425bd849178e17c08efa05c2614f28.zip |
Fix race condition in pw caused by multiple instances of pwd_mkdb being
run at the same time.
Notes:
The fileupdate function is still somewhat broken. Instead of
returning a failure code if it can't modify the original file it
renames the .new file and continues as though nothing is wrong.
This will cause the lock on the original file to be lost and could
lead to a similar race condition. I left that portion of the code
alone since I feel that the maintainer of the code would have a
better concept of how he wants to handle errors in that function
than I do.
PR: bin/6787
Submitted by: Craig Spannring <cts@internetcds.com>
Notes
Notes:
svn path=/head/; revision=37711
Diffstat (limited to 'usr.sbin/pw/edgroup.c')
-rw-r--r-- | usr.sbin/pw/edgroup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pw/edgroup.c b/usr.sbin/pw/edgroup.c index c927b06cc30a..6116fa6854ac 100644 --- a/usr.sbin/pw/edgroup.c +++ b/usr.sbin/pw/edgroup.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$Id$"; + "$Id: edgroup.c,v 1.5 1997/10/10 06:23:30 charnier Exp $"; #endif /* not lint */ #include <stdio.h> @@ -64,7 +64,7 @@ editgroups(char *name, char **groups) int rc = 0; int infd; - if ((infd = open(groupfile, O_RDWR | O_CREAT | O_EXLOCK, 0644)) != -1) { + if ((infd = open(groupfile, O_RDWR | O_CREAT, 0644)) != -1) { FILE *infp; if ((infp = fdopen(infd, "r+")) == NULL) |