Annotation of /trunk/dash/patches/dash-0.5.6.1-do-not-close-stderr.patch
Parent Directory | Revision Log
Revision 1352 -
(hide annotations)
(download)
Fri Jun 3 22:58:19 2011 UTC (13 years, 3 months ago) by niro
File size: 746 byte(s)
Fri Jun 3 22:58:19 2011 UTC (13 years, 3 months ago) by niro
File size: 746 byte(s)
added dash patches
1 | niro | 1352 | commit fcc4134a7b76d82d39dea635c41ec593a41d6d19 |
2 | Author: Herbert Xu <herbert@gondor.apana.org.au> | ||
3 | Date: Sun Feb 22 19:29:48 2009 +0800 | ||
4 | |||
5 | [JOBS] Do not close stderr when /dev/tty fails to open | ||
6 | |||
7 | As it stands if we fail to open /dev/tty we end up closing stderr | ||
8 | after saving it at a higher fd. | ||
9 | |||
10 | Thanks to David van Gorkom for reporting this. | ||
11 | |||
12 | Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> | ||
13 | |||
14 | diff --git a/src/jobs.c b/src/jobs.c | ||
15 | index 69a84f7..b1ab7ab 100644 | ||
16 | --- a/src/jobs.c | ||
17 | +++ b/src/jobs.c | ||
18 | @@ -195,6 +195,9 @@ setjobctl(int on) | ||
19 | while (!isatty(fd)) | ||
20 | if (--fd < 0) | ||
21 | goto out; | ||
22 | + fd = dup(fd); | ||
23 | + if (fd < 0) | ||
24 | + goto out; | ||
25 | } | ||
26 | fd = savefd(fd); | ||
27 | do { /* while we are in the background */ |