]>
Commit | Line | Data |
---|---|---|
8e696ddf | 1 | --- bash-2.02.1/builtins/echo.def Tue Feb 11 19:00:21 1997 |
2 | +++ bash-2.02.1.new/builtins/echo.def Tue Oct 6 04:15:29 1998 | |
3 | @@ -163,5 +163,10 @@ | |
4 | if (display_return) | |
5 | putchar ('\n'); | |
6 | fflush (stdout); | |
7 | + if (ferror(stdout)) | |
8 | + { | |
9 | + clearerr(stdout); | |
10 | + return (EXECUTION_FAILURE); | |
11 | + } | |
12 | return (EXECUTION_SUCCESS); | |
13 | } | |
14 | diff -Nru bash-2.02.1/builtins/fc.def bash-2.02.1.new/builtins/fc.def | |
15 | --- bash-2.02.1/builtins/fc.def Thu Jul 17 15:42:44 1997 | |
16 | +++ bash-2.02.1.new/builtins/fc.def Tue Oct 6 04:15:29 1998 | |
17 | @@ -161,7 +161,7 @@ | |
18 | REPL *rlist, *rl; | |
19 | char *ename, *command, *newcom, *line; | |
20 | HIST_ENTRY **hlist; | |
21 | - char fn[64]; | |
22 | + char *fn = 0; | |
23 | ||
24 | numbering = 1; | |
25 | reverse = listing = execute = 0; | |
26 | @@ -326,15 +326,29 @@ | |
27 | stream = stdout; | |
28 | else | |
29 | { | |
30 | + int fd; | |
31 | numbering = 0; | |
32 | - /* XXX - this is raceable */ | |
33 | - sprintf (fn, "/tmp/bash%d", (int)time ((time_t *) 0) + (int)getpid ()); | |
34 | + fn = tempnam(0, "bash"); | |
35 | + if (!fn) | |
36 | + { | |
37 | + builtin_error ("unable to generate a unique filename"); | |
38 | + return (EXECUTION_FAILURE); | |
39 | + } | |
40 | + | |
41 | + fd = open (fn, O_CREAT | O_EXCL | O_WRONLY, 0600); | |
42 | + if (fd < 0) | |
43 | + { | |
44 | + builtin_error ("cannot open temp file %s", fn); | |
45 | + free (fn); | |
46 | + return (EXECUTION_FAILURE); | |
47 | + } | |
48 | ||
49 | - stream = fopen (fn, "w"); | |
50 | + stream = fdopen (fd, "w"); | |
51 | ||
52 | if (stream == 0) | |
53 | { | |
54 | builtin_error ("cannot open temp file %s", fn); | |
55 | + free (fn); | |
56 | return (EXECUTION_FAILURE); | |
57 | } | |
58 | } | |
59 | @@ -350,7 +364,10 @@ | |
60 | } | |
61 | ||
62 | if (listing) | |
63 | + { | |
64 | + free (fn); | |
65 | return (EXECUTION_SUCCESS); | |
66 | + } | |
67 | ||
68 | fclose (stream); | |
69 | ||
70 | @@ -369,6 +386,7 @@ | |
71 | if (retval != EXECUTION_SUCCESS) | |
72 | { | |
73 | unlink (fn); | |
74 | + free (fn); | |
75 | return (EXECUTION_FAILURE); | |
76 | } | |
77 | ||
78 | @@ -442,6 +461,7 @@ | |
79 | ||
80 | run_unwind_frame ("fc builtin"); | |
81 | ||
82 | + free (fn); | |
83 | return (retval); | |
84 | } | |
85 | ||
86 | diff -Nru bash-2.02.1/doc/bash.1 bash-2.02.1.new/doc/bash.1 | |
87 | --- bash-2.02.1/doc/bash.1 Wed Apr 1 19:25:56 1998 | |
88 | +++ bash-2.02.1.new/doc/bash.1 Tue Oct 6 04:15:29 1998 | |
89 | @@ -7214,6 +7214,8 @@ | |
90 | .\" bash_builtins | |
91 | .if \n(zZ=1 .ig zZ | |
92 | .SH "RESTRICTED SHELL" | |
93 | +.\" start of rbash man | |
94 | +.zY | |
95 | .PP | |
96 | If | |
97 | .B bash | |
98 | @@ -7281,6 +7283,8 @@ | |
99 | .B rbash | |
100 | turns off any restrictions in the shell spawned to execute the | |
101 | script. | |
102 | +.\" end of rbash man | |
103 | +.if \n(zY=1 .ig zY | |
104 | .SH "SEE ALSO" | |
105 | .PD 0 | |
106 | .TP | |
107 | @@ -7395,3 +7399,4 @@ | |
108 | .PP | |
109 | Array variables may not (yet) be exported. | |
110 | .zZ | |
111 | +.zY | |
112 | diff -Nru bash-2.02.1/general.h bash-2.02.1.new/general.h | |
113 | --- bash-2.02.1/general.h Tue Feb 24 21:51:04 1998 | |
114 | +++ bash-2.02.1.new/general.h Tue Oct 6 04:15:29 1998 | |
115 | @@ -21,6 +21,7 @@ | |
116 | #if !defined (_GENERAL_H_) | |
117 | #define _GENERAL_H_ | |
118 | ||
119 | +#include <sys/types.h> | |
120 | #include "stdc.h" | |
121 | ||
122 | #include "bashtypes.h" | |
123 | diff -Nru bash-2.02.1/subst.c bash-2.02.1.new/subst.c | |
124 | --- bash-2.02.1/subst.c Tue Jun 30 18:09:45 1998 | |
125 | +++ bash-2.02.1.new/subst.c Tue Oct 6 04:15:29 1998 | |
126 | @@ -2749,8 +2749,8 @@ | |
127 | { | |
128 | char *tname; | |
129 | ||
130 | - tname = mktemp (savestring ("/tmp/sh-np-XXXXXX")); | |
131 | - if (mkfifo (tname, 0600) < 0) | |
132 | + tname = tempnam(0, "sh-np"); | |
133 | + if (!tname || mkfifo (tname, 0600) < 0) | |
134 | { | |
135 | free (tname); | |
136 | return ((char *)NULL); |