1 |
vapier 08/02/06 15:36:39 |
2 |
|
3 |
Added: busybox-1.9.0-zcip.patch busybox-1.9.0-stty.patch |
4 |
busybox-1.9.0-allno.patch busybox-1.9.0-msh.patch |
5 |
busybox-1.9.0-iproute.patch |
6 |
busybox-1.9.0-nameif.patch |
7 |
busybox-1.9.0-mkswap.patch busybox-1.9.0-fsck.patch |
8 |
busybox-1.9.0-nohup.patch |
9 |
Log: |
10 |
Version bump. |
11 |
(Portage version: 2.1.4.1) |
12 |
|
13 |
Revision Changes Path |
14 |
1.1 sys-apps/busybox/files/busybox-1.9.0-zcip.patch |
15 |
|
16 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-zcip.patch?rev=1.1&view=markup |
17 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-zcip.patch?rev=1.1&content-type=text/plain |
18 |
|
19 |
Index: busybox-1.9.0-zcip.patch |
20 |
=================================================================== |
21 |
--- busybox-1.9.0/networking/zcip.c Fri Dec 21 22:00:25 2007 |
22 |
+++ busybox-1.9.0-zcip/networking/zcip.c Mon Feb 4 09:37:14 2008 |
23 |
@@ -180,7 +180,7 @@ |
24 |
char *r_opt; |
25 |
unsigned opts; |
26 |
|
27 |
- /* Ugly trick, but I want these zeroed in one go */ |
28 |
+ // ugly trick, but I want these zeroed in one go |
29 |
struct { |
30 |
const struct in_addr null_ip; |
31 |
const struct ether_addr null_addr; |
32 |
@@ -214,8 +214,17 @@ |
33 |
// exactly 2 args; -v accumulates and implies -f |
34 |
opt_complementary = "=2:vv:vf"; |
35 |
opts = getopt32(argv, "fqr:v", &r_opt, &verbose); |
36 |
+#if !BB_MMU |
37 |
+ // on NOMMU reexec early (or else we will rerun things twice) |
38 |
+ if (!FOREGROUND) |
39 |
+ bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); |
40 |
+#endif |
41 |
+ // open an ARP socket |
42 |
+ // (need to do it before openlog to prevent openlog from taking |
43 |
+ // fd 3 (sock_fd==3)) |
44 |
+ xmove_fd(xsocket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)), sock_fd); |
45 |
if (!FOREGROUND) { |
46 |
- /* Do it early, before all bb_xx_msg calls */ |
47 |
+ // do it before all bb_xx_msg calls |
48 |
openlog(applet_name, 0, LOG_DAEMON); |
49 |
logmode |= LOGMODE_SYSLOG; |
50 |
} |
51 |
@@ -226,11 +235,6 @@ |
52 |
bb_error_msg_and_die("invalid link address"); |
53 |
} |
54 |
} |
55 |
- // On NOMMU reexec early (or else we will rerun things twice) |
56 |
-#if !BB_MMU |
57 |
- if (!FOREGROUND) |
58 |
- bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); |
59 |
-#endif |
60 |
argc -= optind; |
61 |
argv += optind; |
62 |
|
63 |
@@ -249,8 +253,6 @@ |
64 |
//TODO: are we leaving sa_family == 0 (AF_UNSPEC)?! |
65 |
safe_strncpy(saddr.sa_data, intf, sizeof(saddr.sa_data)); |
66 |
|
67 |
- // open an ARP socket |
68 |
- xmove_fd(xsocket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)), sock_fd); |
69 |
// bind to the interface's ARP socket |
70 |
xbind(sock_fd, &saddr, sizeof(saddr)); |
71 |
|
72 |
@@ -290,7 +292,7 @@ |
73 |
// restarting after address conflicts: |
74 |
// - start with some address we want to try |
75 |
// - short random delay |
76 |
- // - arp probes to see if another host else uses it |
77 |
+ // - arp probes to see if another host uses it |
78 |
// - arp announcements that we're claiming it |
79 |
// - use it |
80 |
// - defend it, within limits |
81 |
@@ -321,7 +323,7 @@ |
82 |
switch (safe_poll(fds, 1, timeout_ms)) { |
83 |
|
84 |
default: |
85 |
- /*bb_perror_msg("poll"); - done in safe_poll */ |
86 |
+ //bb_perror_msg("poll"); - done in safe_poll |
87 |
return EXIT_FAILURE; |
88 |
|
89 |
// timeout |
90 |
|
91 |
|
92 |
|
93 |
1.1 sys-apps/busybox/files/busybox-1.9.0-stty.patch |
94 |
|
95 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-stty.patch?rev=1.1&view=markup |
96 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-stty.patch?rev=1.1&content-type=text/plain |
97 |
|
98 |
Index: busybox-1.9.0-stty.patch |
99 |
=================================================================== |
100 |
--- busybox-1.9.0/coreutils/stty.c Fri Dec 21 22:00:29 2007 |
101 |
+++ busybox-1.9.0-stty/coreutils/stty.c Sat Feb 2 18:55:40 2008 |
102 |
@@ -780,30 +780,14 @@ |
103 |
|
104 |
static const struct mode_info *find_mode(const char *name) |
105 |
{ |
106 |
- int i = 0; |
107 |
- const char *m = mode_name; |
108 |
- |
109 |
- while (*m) { |
110 |
- if (strcmp(name, m) == 0) |
111 |
- return &mode_info[i]; |
112 |
- m += strlen(m) + 1; |
113 |
- i++; |
114 |
- } |
115 |
- return NULL; |
116 |
+ int i = index_in_strings(mode_name, name); |
117 |
+ return i >= 0 ? &mode_info[i] : NULL; |
118 |
} |
119 |
|
120 |
static const struct control_info *find_control(const char *name) |
121 |
{ |
122 |
- int i = 0; |
123 |
- const char *m = mode_name; |
124 |
- |
125 |
- while (*m) { |
126 |
- if (strcmp(name, m) == 0) |
127 |
- return &control_info[i]; |
128 |
- m += strlen(m) + 1; |
129 |
- i++; |
130 |
- } |
131 |
- return NULL; |
132 |
+ int i = index_in_strings(control_name, name); |
133 |
+ return i >= 0 ? &control_info[i] : NULL; |
134 |
} |
135 |
|
136 |
enum { |
137 |
|
138 |
|
139 |
|
140 |
1.1 sys-apps/busybox/files/busybox-1.9.0-allno.patch |
141 |
|
142 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-allno.patch?rev=1.1&view=markup |
143 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-allno.patch?rev=1.1&content-type=text/plain |
144 |
|
145 |
Index: busybox-1.9.0-allno.patch |
146 |
=================================================================== |
147 |
diff -urN busybox-1.9.0/Makefile.help busybox-1.9.0-allno/Makefile.help |
148 |
--- busybox-1.9.0/Makefile.help 2007-12-21 22:00:33.000000000 +0000 |
149 |
+++ busybox-1.9.0-allno/Makefile.help 2008-01-04 20:03:30.000000000 +0000 |
150 |
@@ -16,7 +16,6 @@ |
151 |
@echo 'Configuration:' |
152 |
@echo ' allnoconfig - disable all symbols in .config' |
153 |
@echo ' allyesconfig - enable all symbols in .config (see defconfig)' |
154 |
- @echo ' allbareconfig - enable all applets without any sub-features' |
155 |
@echo ' config - text based configurator (of last resort)' |
156 |
@echo ' defconfig - set .config to largest generic configuration' |
157 |
@echo ' menuconfig - interactive curses-based configurator' |
158 |
diff -urN busybox-1.9.0/applets/applet_tables.c busybox-1.9.0-allno/applets/applet_tables.c |
159 |
--- busybox-1.9.0/applets/applet_tables.c 2007-12-24 14:08:25.000000000 +0000 |
160 |
+++ busybox-1.9.0-allno/applets/applet_tables.c 2008-01-04 20:00:12.000000000 +0000 |
161 |
@@ -71,7 +71,7 @@ |
162 |
|
163 |
puts("/* This is a generated file, don't edit */"); |
164 |
|
165 |
- puts("const char applet_names[] ALIGN1 ="); |
166 |
+ puts("const char applet_names[] ALIGN1 = \"\" \n"); |
167 |
for (i = 0; i < NUM_APPLETS; i++) { |
168 |
printf("\"%s\" \"\\0\"\n", applets[i].name); |
169 |
} |
170 |
|
171 |
|
172 |
|
173 |
1.1 sys-apps/busybox/files/busybox-1.9.0-msh.patch |
174 |
|
175 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-msh.patch?rev=1.1&view=markup |
176 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-msh.patch?rev=1.1&content-type=text/plain |
177 |
|
178 |
Index: busybox-1.9.0-msh.patch |
179 |
=================================================================== |
180 |
--- busybox-1.9.0/include/libbb.h Fri Dec 21 22:00:31 2007 |
181 |
+++ busybox-1.9.0-msh/include/libbb.h Sat Feb 2 18:55:36 2008 |
182 |
@@ -950,10 +950,9 @@ |
183 |
}; |
184 |
line_input_t *new_line_input_t(int flags); |
185 |
/* Returns: |
186 |
- * -1 on read errors or EOF, or on bare Ctrl-D. |
187 |
- * 0 on ctrl-C, |
188 |
+ * -1 on read errors or EOF, or on bare Ctrl-D, |
189 |
+ * 0 on ctrl-C (the line entered is still returned in 'command'), |
190 |
* >0 length of input string, including terminating '\n' |
191 |
- * [is this true? stores "" in 'command' if return value is 0 or -1] |
192 |
*/ |
193 |
int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state); |
194 |
#else |
195 |
--- busybox-1.9.0/libbb/lineedit.c Mon Dec 24 14:08:25 2007 |
196 |
+++ busybox-1.9.0-msh/libbb/lineedit.c Sat Feb 2 18:55:36 2008 |
197 |
@@ -1315,8 +1315,8 @@ |
198 |
#define CTRL(a) ((a) & ~0x40) |
199 |
|
200 |
/* Returns: |
201 |
- * -1 on read errors or EOF, or on bare Ctrl-D. |
202 |
- * 0 on ctrl-C, |
203 |
+ * -1 on read errors or EOF, or on bare Ctrl-D, |
204 |
+ * 0 on ctrl-C (the line entered is still returned in 'command'), |
205 |
* >0 length of input string, including terminating '\n' |
206 |
*/ |
207 |
int read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st) |
208 |
--- busybox-1.9.0/shell/msh.c Fri Dec 21 22:00:28 2007 |
209 |
+++ busybox-1.9.0-msh/shell/msh.c Sat Feb 2 18:57:12 2008 |
210 |
@@ -2825,11 +2825,13 @@ |
211 |
|
212 |
if (pin != NULL) { |
213 |
xmove_fd(pin[0], 0); |
214 |
- if (pin[1] != 0) close(pin[1]); |
215 |
+ if (pin[1] != 0) |
216 |
+ close(pin[1]); |
217 |
} |
218 |
if (pout != NULL) { |
219 |
xmove_fd(pout[1], 1); |
220 |
- if (pout[1] != 1) close(pout[0]); |
221 |
+ if (pout[1] != 1) |
222 |
+ close(pout[0]); |
223 |
} |
224 |
|
225 |
iopp = t->ioact; |
226 |
@@ -4162,7 +4164,7 @@ |
227 |
return 0; |
228 |
} |
229 |
if (i != 0) { |
230 |
- waitpid(i, NULL, 0); |
231 |
+ waitpid(i, NULL, 0); // safe_waitpid? |
232 |
global_env.iop->argp->aword = ++cp; |
233 |
close(pf[1]); |
234 |
PUSHIO(afile, remap(pf[0]), |
235 |
@@ -4181,7 +4183,8 @@ |
236 |
* echo "$files" >zz |
237 |
*/ |
238 |
xmove_fd(pf[1], 1); |
239 |
- if (pf[0] != 1) close(pf[0]); |
240 |
+ if (pf[0] != 1) |
241 |
+ close(pf[0]); |
242 |
|
243 |
argument_list[0] = (char *) DEFAULT_SHELL; |
244 |
argument_list[1] = (char *) "-c"; |
245 |
@@ -4834,9 +4837,11 @@ |
246 |
static int position = 0, size = 0; |
247 |
|
248 |
while (size == 0 || position >= size) { |
249 |
- read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state); |
250 |
- size = strlen(filechar_cmdbuf); |
251 |
+ size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state); |
252 |
+ if (size < 0) /* Error/EOF */ |
253 |
+ exit(0); |
254 |
position = 0; |
255 |
+ /* if Ctrl-C, size == 0 and loop will repeat */ |
256 |
} |
257 |
c = filechar_cmdbuf[position]; |
258 |
position++; |
259 |
|
260 |
|
261 |
|
262 |
1.1 sys-apps/busybox/files/busybox-1.9.0-iproute.patch |
263 |
|
264 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-iproute.patch?rev=1.1&view=markup |
265 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-iproute.patch?rev=1.1&content-type=text/plain |
266 |
|
267 |
Index: busybox-1.9.0-iproute.patch |
268 |
=================================================================== |
269 |
diff -urN busybox-1.9.0/networking/libiproute/iproute.c busybox-1.9.0-iproute/networking/libiproute/iproute.c |
270 |
--- busybox-1.9.0/networking/libiproute/iproute.c 2007-12-21 22:00:23.000000000 +0000 |
271 |
+++ busybox-1.9.0-iproute/networking/libiproute/iproute.c 2008-01-04 15:18:33.000000000 +0000 |
272 |
@@ -841,15 +841,17 @@ |
273 |
/*0-3*/ "add\0""append\0""change\0""chg\0" |
274 |
/*4-7*/ "delete\0""get\0""list\0""show\0" |
275 |
/*8..*/ "prepend\0""replace\0""test\0""flush\0"; |
276 |
- int command_num = 6; |
277 |
+ int command_num; |
278 |
unsigned flags = 0; |
279 |
int cmd = RTM_NEWROUTE; |
280 |
|
281 |
+ if (!*argv) |
282 |
+ return iproute_list_or_flush(argv, 0); |
283 |
+ |
284 |
/* "Standard" 'ip r a' treats 'a' as 'add', not 'append' */ |
285 |
/* It probably means that it is using "first match" rule */ |
286 |
- if (*argv) { |
287 |
- command_num = index_in_substrings(ip_route_commands, *argv); |
288 |
- } |
289 |
+ command_num = index_in_substrings(ip_route_commands, *argv); |
290 |
+ |
291 |
switch (command_num) { |
292 |
case 0: /* add */ |
293 |
flags = NLM_F_CREATE|NLM_F_EXCL; |
294 |
|
295 |
|
296 |
|
297 |
1.1 sys-apps/busybox/files/busybox-1.9.0-nameif.patch |
298 |
|
299 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-nameif.patch?rev=1.1&view=markup |
300 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-nameif.patch?rev=1.1&content-type=text/plain |
301 |
|
302 |
Index: busybox-1.9.0-nameif.patch |
303 |
=================================================================== |
304 |
diff -urN busybox-1.9.0/networking/nameif.c busybox-1.9.0-nameif/networking/nameif.c |
305 |
--- busybox-1.9.0/networking/nameif.c 2007-12-24 14:08:25.000000000 +0000 |
306 |
+++ busybox-1.9.0-nameif/networking/nameif.c 2008-01-04 20:05:48.000000000 +0000 |
307 |
@@ -50,18 +50,18 @@ |
308 |
#define ETHTOOL_BUSINFO_LEN 32 |
309 |
/* these strings are set to whatever the driver author decides... */ |
310 |
struct ethtool_drvinfo { |
311 |
- __u32 cmd; |
312 |
- char driver[32]; /* driver short name, "tulip", "eepro100" */ |
313 |
- char version[32]; /* driver version string */ |
314 |
- char fw_version[32]; /* firmware version string, if applicable */ |
315 |
- char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ |
316 |
+ uint32_t cmd; |
317 |
+ char driver[32]; /* driver short name, "tulip", "eepro100" */ |
318 |
+ char version[32]; /* driver version string */ |
319 |
+ char fw_version[32]; /* firmware version string, if applicable */ |
320 |
+ char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ |
321 |
/* For PCI devices, use pci_dev->slot_name. */ |
322 |
- char reserved1[32]; |
323 |
- char reserved2[16]; |
324 |
- __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ |
325 |
- __u32 testinfo_len; |
326 |
- __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ |
327 |
- __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ |
328 |
+ char reserved1[32]; |
329 |
+ char reserved2[16]; |
330 |
+ uint32_t n_stats; /* number of u64's from ETHTOOL_GSTATS */ |
331 |
+ uint32_t testinfo_len; |
332 |
+ uint32_t eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ |
333 |
+ uint32_t regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ |
334 |
}; |
335 |
#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ |
336 |
#endif |
337 |
|
338 |
|
339 |
|
340 |
1.1 sys-apps/busybox/files/busybox-1.9.0-mkswap.patch |
341 |
|
342 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-mkswap.patch?rev=1.1&view=markup |
343 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-mkswap.patch?rev=1.1&content-type=text/plain |
344 |
|
345 |
Index: busybox-1.9.0-mkswap.patch |
346 |
=================================================================== |
347 |
--- busybox-1.9.0/util-linux/mkswap.c Fri Dec 21 22:00:33 2007 |
348 |
+++ busybox-1.9.0-mkswap/util-linux/mkswap.c Sat Feb 2 18:55:31 2008 |
349 |
@@ -64,9 +64,10 @@ |
350 |
// Figure out how big the device is and announce our intentions. |
351 |
|
352 |
fd = xopen(argv[1], O_RDWR); |
353 |
- len = fdlength(fd); |
354 |
+ len = lseek(fd, 0, SEEK_END); |
355 |
+ lseek(fd, 0, SEEK_SET); |
356 |
pagesize = getpagesize(); |
357 |
- printf("Setting up swapspace version 1, size = %"OFF_FMT"d bytes\n", |
358 |
+ printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", |
359 |
len - pagesize); |
360 |
mkswap_selinux_setcontext(fd, argv[1]); |
361 |
|
362 |
|
363 |
|
364 |
|
365 |
1.1 sys-apps/busybox/files/busybox-1.9.0-fsck.patch |
366 |
|
367 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-fsck.patch?rev=1.1&view=markup |
368 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-fsck.patch?rev=1.1&content-type=text/plain |
369 |
|
370 |
Index: busybox-1.9.0-fsck.patch |
371 |
=================================================================== |
372 |
--- busybox-1.9.0/e2fsprogs/fsck.c Fri Dec 21 22:00:31 2007 |
373 |
+++ busybox-1.9.0-fsck/e2fsprogs/fsck.c Sat Feb 2 18:55:22 2008 |
374 |
@@ -665,6 +665,12 @@ |
375 |
for (i = num_args+1; i < argc; i++) |
376 |
free(argv[i]); |
377 |
|
378 |
+ /* No pid, so don't record an instance */ |
379 |
+ if (pid < 0) { |
380 |
+ free(inst); |
381 |
+ return; |
382 |
+ } |
383 |
+ |
384 |
inst->pid = pid; |
385 |
inst->prog = argv[0]; |
386 |
inst->type = xstrdup(type); |
387 |
|
388 |
|
389 |
|
390 |
1.1 sys-apps/busybox/files/busybox-1.9.0-nohup.patch |
391 |
|
392 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-nohup.patch?rev=1.1&view=markup |
393 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/busybox/files/busybox-1.9.0-nohup.patch?rev=1.1&content-type=text/plain |
394 |
|
395 |
Index: busybox-1.9.0-nohup.patch |
396 |
=================================================================== |
397 |
--- trunk/busybox/coreutils/nohup.c 2007/10/11 10:05:36 20219 |
398 |
+++ trunk/busybox/coreutils/nohup.c 2008/02/04 00:30:06 20940 |
399 |
@@ -12,21 +12,41 @@ |
400 |
|
401 |
#include "libbb.h" |
402 |
|
403 |
+/* Compat info: nohup (GNU coreutils 6.8) does this: |
404 |
+# nohup true |
405 |
+nohup: ignoring input and appending output to `nohup.out' |
406 |
+# nohup true 1>/dev/null |
407 |
+nohup: ignoring input and redirecting stderr to stdout |
408 |
+# nohup true 2>zz |
409 |
+# cat zz |
410 |
+nohup: ignoring input and appending output to `nohup.out' |
411 |
+# nohup true 2>zz 1>/dev/null |
412 |
+# cat zz |
413 |
+nohup: ignoring input |
414 |
+# nohup true </dev/null 1>/dev/null |
415 |
+nohup: redirecting stderr to stdout |
416 |
+# nohup true </dev/null 2>zz 1>/dev/null |
417 |
+# cat zz |
418 |
+ (nothing) |
419 |
+# |
420 |
+*/ |
421 |
+ |
422 |
int nohup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
423 |
int nohup_main(int argc, char **argv) |
424 |
{ |
425 |
- int nullfd; |
426 |
const char *nohupout; |
427 |
- char *home = NULL; |
428 |
+ char *home; |
429 |
|
430 |
xfunc_error_retval = 127; |
431 |
|
432 |
if (argc < 2) bb_show_usage(); |
433 |
|
434 |
- nullfd = xopen(bb_dev_null, O_WRONLY|O_APPEND); |
435 |
/* If stdin is a tty, detach from it. */ |
436 |
- if (isatty(STDIN_FILENO)) |
437 |
- dup2(nullfd, STDIN_FILENO); |
438 |
+ if (isatty(STDIN_FILENO)) { |
439 |
+ /* bb_error_msg("ignoring input"); */ |
440 |
+ close(STDIN_FILENO); |
441 |
+ xopen(bb_dev_null, O_RDONLY); /* will be fd 0 (STDIN_FILENO) */ |
442 |
+ } |
443 |
|
444 |
nohupout = "nohup.out"; |
445 |
/* Redirect stdout to nohup.out, either in "." or in "$HOME". */ |
446 |
@@ -37,24 +57,22 @@ |
447 |
if (home) { |
448 |
nohupout = concat_path_file(home, nohupout); |
449 |
xopen3(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR); |
450 |
+ } else { |
451 |
+ xopen(bb_dev_null, O_RDONLY); /* will be fd 1 */ |
452 |
} |
453 |
} |
454 |
- } else dup2(nullfd, STDOUT_FILENO); |
455 |
+ bb_error_msg("appending output to %s", nohupout); |
456 |
+ } |
457 |
|
458 |
- /* If we have a tty on stderr, announce filename and redirect to stdout. |
459 |
- * Else redirect to /dev/null. |
460 |
- */ |
461 |
+ /* If we have a tty on stderr, redirect to stdout. */ |
462 |
if (isatty(STDERR_FILENO)) { |
463 |
- bb_error_msg("appending to %s", nohupout); |
464 |
+ /* if (stdout_wasnt_a_tty) |
465 |
+ bb_error_msg("redirecting stderr to stdout"); */ |
466 |
dup2(STDOUT_FILENO, STDERR_FILENO); |
467 |
- } else dup2(nullfd, STDERR_FILENO); |
468 |
+ } |
469 |
|
470 |
- if (nullfd > 2) |
471 |
- close(nullfd); |
472 |
signal(SIGHUP, SIG_IGN); |
473 |
|
474 |
BB_EXECVP(argv[1], argv+1); |
475 |
- if (ENABLE_FEATURE_CLEAN_UP && home) |
476 |
- free((char*)nohupout); |
477 |
bb_simple_perror_msg_and_die(argv[1]); |
478 |
} |
479 |
|
480 |
|
481 |
|
482 |
-- |
483 |
gentoo-commits@l.g.o mailing list |