]> git.pld-linux.org Git - packages/byacc.git/commitdiff
- fix tmp race (patch from rawhide).
authorkloczek <kloczek@pld-linux.org>
Sun, 10 Mar 2002 10:15:34 +0000 (10:15 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    byacc-security.patch -> 1.1

byacc-security.patch [new file with mode: 0644]

diff --git a/byacc-security.patch b/byacc-security.patch
new file mode 100644 (file)
index 0000000..a9029f9
--- /dev/null
@@ -0,0 +1,56 @@
+--- byacc-1.9/main.c.orig      Mon Feb 22 07:32:46 1993
++++ byacc-1.9/main.c   Sun Mar 10 10:52:31 2002
+@@ -57,16 +57,29 @@
+ short **derives;
+ char *nullable;
+-extern char *mktemp();
++#ifdef linux
++# define mktemp               safe_mktemp
++extern void           safe_mktemp(char *tmpl);
++#endif
++
+ extern char *getenv();
+ done(k)
+ int k;
+ {
+-    if (action_file) { fclose(action_file); unlink(action_file_name); }
+-    if (text_file) { fclose(text_file); unlink(text_file_name); }
+-    if (union_file) { fclose(union_file); unlink(union_file_name); }
++    if (action_file)
++      fclose(action_file);
++    if (action_file_name[0])
++      unlink(action_file_name);
++    if (text_file)
++      fclose(text_file);
++    if (text_file_name[0])
++      unlink(text_file_name);
++    if (union_file)
++      fclose(union_file);
++    if (union_file_name[0])
++      unlink(union_file_name);
+     exit(k);
+ }
+@@ -355,6 +368,19 @@
+       code_file = output_file;
+ }
++#ifdef linux
++void
++safe_mktemp(char *fname)
++{
++    int       fd;
++
++    if ((fd = mkstemp(fname)) < 0) {
++        perror("unable to create temp file");
++      exit(1);
++    }
++    close(fd);
++}
++#endif
+ int
+ main(argc, argv)
This page took 0.056349 seconds and 4 git commands to generate.