summaryrefslogtreecommitdiff
path: root/usr.bin/chpass
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-30 13:29:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-30 13:29:13 +0000
commitd385705f4dc30b0c3125ad14786cc10185a42fef (patch)
tree357fc9ac0d089106cfa884dc936cc91d31e86074 /usr.bin/chpass
parentac6e8259e5cda6c726a72c5954f0655911704084 (diff)
watch for slimy link races, improvement by das33@cornell.edu & i
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r--usr.bin/chpass/edit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index 3cab39cccc1..43c16e38c92 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.5 1996/08/26 22:55:37 deraadt Exp $ */
+/* $OpenBSD: edit.c,v 1.6 1996/08/30 13:29:12 deraadt Exp $ */
/* $NetBSD: edit.c,v 1.6 1996/05/15 21:50:45 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: edit.c,v 1.5 1996/08/26 22:55:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: edit.c,v 1.6 1996/08/30 13:29:12 deraadt Exp $";
#endif
#endif /* not lint */
@@ -66,10 +66,10 @@ edit(tempname, pw)
struct stat begin, end;
for (;;) {
- if (stat(tempname, &begin))
+ if (lstat(tempname, &begin) == -1 || S_ISLNK(begin.st_mode))
pw_error(tempname, 1, 1);
pw_edit(1, tempname);
- if (stat(tempname, &end))
+ if (lstat(tempname, &end) == -1 || S_ISLNK(begin.st_mode))
pw_error(tempname, 1, 1);
if (begin.st_mtime == end.st_mtime) {
warnx("no changes made");