diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-03-04 01:05:04 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-03-04 01:05:04 +0000 |
commit | 321dd4918cfe143845ce009f43952e90d456a64e (patch) | |
tree | a0d9377383a59ee3061b327d69b3ba686f3067f0 /gnu | |
parent | f136b21fd73cfa6f2081681208861ef7407a7a9e (diff) |
mktemp() -> mkstemp()
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/rcs/src/rcsedit.c | 12 | ||||
-rw-r--r-- | gnu/usr.bin/rcs/src/rcsfnms.c | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/gnu/usr.bin/rcs/src/rcsedit.c b/gnu/usr.bin/rcs/src/rcsedit.c index 490ea6e4dfa..d9513e82410 100644 --- a/gnu/usr.bin/rcs/src/rcsedit.c +++ b/gnu/usr.bin/rcs/src/rcsedit.c @@ -36,6 +36,9 @@ Report problems and direct all questions to: /* * $Log: rcsedit.c,v $ + * Revision 1.3 1998/03/04 01:05:01 angelos + * mktemp() -> mkstemp() + * * Revision 1.2 1996/08/15 12:15:45 millert * Use relative path for RCSLOCALID (like $Id) * @@ -208,7 +211,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(editId, "$Id: rcsedit.c,v 1.2 1996/08/15 12:15:45 millert Exp $") +libId(editId, "$Id: rcsedit.c,v 1.3 1998/03/04 01:05:01 angelos Exp $") static void editEndsPrematurely P((void)) exiting; static void editLineNumberOverflow P((void)) exiting; @@ -1510,6 +1513,9 @@ makedirtemp(isworkfile) register size_t dl; register struct buf *bn; register char const *name = isworkfile ? workname : RCSname; +# if has_mktemp + int fd; +# endif dl = basefilename(name) - name; bn = &dirtpname[newRCSdirtp_index + isworkfile]; @@ -1528,10 +1534,12 @@ makedirtemp(isworkfile) catchints(); # if has_mktemp VOID strcpy(tp, "XXXXXX"); - if (!mktemp(np) || !*np) + fd = mkstemp(np); + if (fd < 0 || !*np) faterror("can't make temporary pathname `%.*s_%cXXXXXX'", (int)dl, name, '0'+isworkfile ); + close(fd); # else /* * Posix 1003.1-1990 has no reliable way diff --git a/gnu/usr.bin/rcs/src/rcsfnms.c b/gnu/usr.bin/rcs/src/rcsfnms.c index 89948c6bab7..d4a45f66584 100644 --- a/gnu/usr.bin/rcs/src/rcsfnms.c +++ b/gnu/usr.bin/rcs/src/rcsfnms.c @@ -39,6 +39,9 @@ Report problems and direct all questions to: /* * $Log: rcsfnms.c,v $ + * Revision 1.2 1998/03/04 01:05:03 angelos + * mktemp() -> mkstemp() + * * Revision 1.1 1996/08/12 04:08:18 millert * rcs 5.7 + OpenBSD changes * @@ -181,7 +184,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(fnmsId, "$Id: rcsfnms.c,v 1.1 1996/08/12 04:08:18 millert Exp $") +libId(fnmsId, "$Id: rcsfnms.c,v 1.2 1998/03/04 01:05:03 angelos Exp $") static char const *bindex P((char const*,int)); static int fin2open P((char const*, size_t, char const*, size_t, char const*, size_t, RILE*(*)P((struct buf*,struct stat*,int)), int)); @@ -288,6 +291,9 @@ maketemp(n) { char *p; char const *t = tpnames[n]; +# if has_mktemp + int fd; +# endif if (t) return t; @@ -299,10 +305,12 @@ maketemp(n) size_t tplen = dir_useful_len(tp); p = testalloc(tplen + 10); VOID sprintf(p, "%.*s%cT%cXXXXXX", (int)tplen, tp, SLASH, '0'+n); - if (!mktemp(p) || !*p) + fd = mkstemp(p); + if (fd < 0 || !*p) faterror("can't make temporary pathname `%.*s%cT%cXXXXXX'", (int)tplen, tp, SLASH, '0'+n ); + close(fd); # else static char tpnamebuf[TEMPNAMES][L_tmpnam]; p = tpnamebuf[n]; |