openbsd-ports/devel/bison/patches/patch-src_files_c
2001-07-13 01:55:59 +00:00

70 lines
2.2 KiB
Plaintext

$OpenBSD: patch-src_files_c,v 1.1 2001/07/13 01:56:00 brad Exp $
--- src/files.c.orig Wed May 19 07:43:04 1999
+++ src/files.c Thu Jul 12 21:14:27 2001
@@ -76,7 +76,7 @@ char *tmpdefsfile;
extern int noparserflag;
-extern char *mktemp(); /* So the compiler won't complain */
+extern int mkstemp(); /* So the compiler won't complain */
extern char *getenv();
extern void perror();
@@ -276,21 +276,46 @@ openfiles (void)
tmpdefsfile = mktemp(stringappend(tmp_base, tmp_len, "deXXXXXX"));
#else
if (! noparserflag)
- actfile = mktemp(stringappend(tmp_base, tmp_len, "act.XXXXXX"));
- tmpattrsfile = mktemp(stringappend(tmp_base, tmp_len, "attrs.XXXXXX"));
- tmptabfile = mktemp(stringappend(tmp_base, tmp_len, "tab.XXXXXX"));
- tmpdefsfile = mktemp(stringappend(tmp_base, tmp_len, "defs.XXXXXX"));
-#endif /* not MSDOS */
+ {
+ actfile = stringappend(tmp_base, tmp_len, "act.XXXXXX");
+ faction = fdopen(mkstemp(actfile), "w+");
+ if (faction == NULL)
+ {
+ fprintf(stderr, "%s: ", program_name);
+ perror(actfile);
+ done(2);
- if (! noparserflag)
- faction = tryopen(actfile, "w+");
- fattrs = tryopen(tmpattrsfile,"w+");
- ftable = tryopen(tmptabfile, "w+");
+ }
+ }
+ tmpattrsfile = stringappend(tmp_base, tmp_len, "attrs.XXXXXX");
+ fattrs = fdopen(mkstemp(tmpattrsfile), "w+");
+ if (fattrs == NULL)
+ {
+ fprintf(stderr, "%s: ", program_name);
+ perror(tmpattrsfile);
+ done(2);
+ }
+ tmptabfile = stringappend(tmp_base, tmp_len, "tab.XXXXXX");
+ ftable = fdopen(mkstemp(tmptabfile), "w+");
+ if (ftable == NULL)
+ {
+ fprintf(stderr, "%s: ", program_name);
+ perror(tmptabfile);
+ done(2);
+ }
+ tmpdefsfile = stringappend(tmp_base, tmp_len, "defs.XXXXXX");
+#endif /* not MSDOS */
if (definesflag)
{
defsfile = stringappend(name_base, base_length, ".h");
- fdefines = tryopen(tmpdefsfile, "w+");
+ fdefines = fdopen(mkstemp(tmpdefsfile), "w+");
+ if (fdefines == NULL)
+ {
+ fprintf(stderr, "%s: ", program_name);
+ perror(tmpdefsfile);
+ done(2);
+ }
}
#if !(defined (MSDOS) || (defined(_WIN32) && !defined(__CYGWIN32__)))