projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
get the temporary file and fd handling right.
[unix-history]
/
usr
/
src
/
usr.bin
/
chpass
/
pw_copy.c
diff --git
a/usr/src/usr.bin/chpass/pw_copy.c
b/usr/src/usr.bin/chpass/pw_copy.c
index
a353a24
..
2ebd73c
100644
(file)
--- a/
usr/src/usr.bin/chpass/pw_copy.c
+++ b/
usr/src/usr.bin/chpass/pw_copy.c
@@
-6,7
+6,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)pw_copy.c 5.
1
(Berkeley) %G%";
+static char sccsid[] = "@(#)pw_copy.c 5.
2
(Berkeley) %G%";
#endif /* not lint */
/*
#endif /* not lint */
/*
@@
-20,8
+20,8
@@
static char sccsid[] = "@(#)pw_copy.c 5.1 (Berkeley) %G%";
extern char *tempname;
extern char *tempname;
-pw_copy(ffd, pw)
- int ffd;
+pw_copy(ffd,
tfd,
pw)
+ int ffd
, tfd
;
struct passwd *pw;
{
register FILE *from, *to;
struct passwd *pw;
{
register FILE *from, *to;
@@
-31,7
+31,7
@@
pw_copy(ffd, pw)
if (!(from = fdopen(ffd, "r")))
pw_error(_PATH_MASTERPASSWD, 1, 1);
if (!(from = fdopen(ffd, "r")))
pw_error(_PATH_MASTERPASSWD, 1, 1);
- if (!(to = f
open(tempname
, "w")))
+ if (!(to = f
dopen(tfd
, "w")))
pw_error(tempname, 1, 1);
for (done = 0; fgets(buf, sizeof(buf), from);) {
pw_error(tempname, 1, 1);
for (done = 0; fgets(buf, sizeof(buf), from);) {