diff options
Diffstat (limited to 'usr.bin/patch')
-rw-r--r-- | usr.bin/patch/common.h | 7 | ||||
-rw-r--r-- | usr.bin/patch/patch.c | 20 |
2 files changed, 18 insertions, 9 deletions
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h index 2a7154c5596..96421b22d50 100644 --- a/usr.bin/patch/common.h +++ b/usr.bin/patch/common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: common.h,v 1.3 1996/06/25 23:06:36 deraadt Exp $ */ +/* $OpenBSD: common.h,v 1.4 1996/09/24 02:58:53 millert Exp $ */ #define DEBUGGING @@ -17,7 +17,6 @@ #define Fclose (void)fclose #define Fflush (void)fflush #define Sprintf (void)sprintf -#define Mktemp (void)mktemp #define Strcpy (void)strcpy #define Strcat (void)strcat @@ -83,6 +82,8 @@ #define strnNE(s1,s2,l) (strncmp(s1, s2, l)) #define strnEQ(s1,s2,l) (!strncmp(s1, s2, l)) +#define Mkstemp mkstemp + /* typedefs */ typedef char bool; @@ -168,7 +169,7 @@ char *getenv(); char *strcpy(); char *strcat(); char *rindex(); -char *mktemp(); +int mkstemp(); #if 0 /* This can cause a prototype conflict. */ #ifdef CHARSPRINTF char *sprintf(); diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 9ad408495da..41884781e03 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.6 1996/09/23 10:54:21 deraadt Exp $ */ +/* $OpenBSD: patch.c,v 1.7 1996/09/24 02:58:52 millert Exp $ */ /* patch - a program to apply diffs to original files * @@ -9,7 +9,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: patch.c,v 1.6 1996/09/23 10:54:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: patch.c,v 1.7 1996/09/24 02:58:52 millert Exp $"; #endif /* not lint */ #include "INTERN.h" @@ -81,22 +81,30 @@ char **argv; TMPOUTNAME = (char *) malloc (tmpname_len); strcpy (TMPOUTNAME, tmpdir); strcat (TMPOUTNAME, "/patchoXXXXXX"); - Mktemp(TMPOUTNAME); + if ((i = Mkstemp(TMPOUTNAME)) < 0) + pfatal2("can't create %s", TMPOUTNAME); + Close(i); TMPINNAME = (char *) malloc (tmpname_len); strcpy (TMPINNAME, tmpdir); strcat (TMPINNAME, "/patchiXXXXXX"); - Mktemp(TMPINNAME); + if ((i = Mkstemp(TMPINNAME)) < 0) + pfatal2("can't create %s", TMPINNAME); + Close(i); TMPREJNAME = (char *) malloc (tmpname_len); strcpy (TMPREJNAME, tmpdir); strcat (TMPREJNAME, "/patchrXXXXXX"); - Mktemp(TMPREJNAME); + if ((i = Mkstemp(TMPREJNAME)) < 0) + pfatal2("can't create %s", TMPREJNAME); + Close(i); TMPPATNAME = (char *) malloc (tmpname_len); strcpy (TMPPATNAME, tmpdir); strcat (TMPPATNAME, "/patchpXXXXXX"); - Mktemp(TMPPATNAME); + if ((i = Mkstemp(TMPPATNAME)) < 0) + pfatal2("can't create %s", TMPPATNAME); + Close(i); } { |