]> git.pld-linux.org Git - packages/bash.git/blame - bash-fixes.patch
- more terminal types
[packages/bash.git] / bash-fixes.patch
CommitLineData
8e696ddf 1diff -Nru bash-2.02.1/builtins/fc.def bash-2.02.1.new/builtins/fc.def
2--- bash-2.02.1/builtins/fc.def Thu Jul 17 15:42:44 1997
3+++ bash-2.02.1.new/builtins/fc.def Tue Oct 6 04:15:29 1998
4@@ -161,7 +161,7 @@
5 REPL *rlist, *rl;
6 char *ename, *command, *newcom, *line;
7 HIST_ENTRY **hlist;
8- char fn[64];
9+ char *fn = 0;
10
11 numbering = 1;
12 reverse = listing = execute = 0;
13@@ -326,15 +326,29 @@
14 stream = stdout;
15 else
16 {
17+ int fd;
18 numbering = 0;
19- /* XXX - this is raceable */
20- sprintf (fn, "/tmp/bash%d", (int)time ((time_t *) 0) + (int)getpid ());
21+ fn = tempnam(0, "bash");
22+ if (!fn)
23+ {
24+ builtin_error ("unable to generate a unique filename");
25+ return (EXECUTION_FAILURE);
26+ }
27+
28+ fd = open (fn, O_CREAT | O_EXCL | O_WRONLY, 0600);
29+ if (fd < 0)
30+ {
31+ builtin_error ("cannot open temp file %s", fn);
32+ free (fn);
33+ return (EXECUTION_FAILURE);
34+ }
35
36- stream = fopen (fn, "w");
37+ stream = fdopen (fd, "w");
38
39 if (stream == 0)
40 {
41 builtin_error ("cannot open temp file %s", fn);
42+ free (fn);
43 return (EXECUTION_FAILURE);
44 }
45 }
46@@ -350,7 +364,10 @@
47 }
48
49 if (listing)
50+ {
51+ free (fn);
52 return (EXECUTION_SUCCESS);
53+ }
54
55 fclose (stream);
56
57@@ -369,6 +386,7 @@
58 if (retval != EXECUTION_SUCCESS)
59 {
60 unlink (fn);
61+ free (fn);
62 return (EXECUTION_FAILURE);
63 }
64
65@@ -442,6 +461,7 @@
66
67 run_unwind_frame ("fc builtin");
68
69+ free (fn);
70 return (retval);
71 }
72
8e696ddf 73diff -Nru bash-2.02.1/general.h bash-2.02.1.new/general.h
74--- bash-2.02.1/general.h Tue Feb 24 21:51:04 1998
75+++ bash-2.02.1.new/general.h Tue Oct 6 04:15:29 1998
76@@ -21,6 +21,7 @@
77 #if !defined (_GENERAL_H_)
78 #define _GENERAL_H_
79
80+#include <sys/types.h>
81 #include "stdc.h"
82
83 #include "bashtypes.h"
84diff -Nru bash-2.02.1/subst.c bash-2.02.1.new/subst.c
85--- bash-2.02.1/subst.c Tue Jun 30 18:09:45 1998
86+++ bash-2.02.1.new/subst.c Tue Oct 6 04:15:29 1998
87@@ -2749,8 +2749,8 @@
88 {
89 char *tname;
90
91- tname = mktemp (savestring ("/tmp/sh-np-XXXXXX"));
92- if (mkfifo (tname, 0600) < 0)
93+ tname = tempnam(0, "sh-np");
94+ if (!tname || mkfifo (tname, 0600) < 0)
95 {
96 free (tname);
97 return ((char *)NULL);
This page took 0.10929 seconds and 4 git commands to generate.