dash/dash-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch
OBS User autobuild 14e7d1b39e Accepting request 32541 from shells
Copy from shells/dash based on submit request 32541 from user gberh

OBS-URL: https://build.opensuse.org/request/show/32541
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dash?expand=0&rev=1
2010-02-18 13:38:26 +00:00

30 lines
861 B
Diff

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sun, 22 Feb 2009 11:29:48 +0000 (+0800)
Subject: [JOBS] Do not close stderr when /dev/tty fails to open
X-Git-Url: http://git.kernel.org/?p=utils%2Fdash%2Fdash.git;a=commitdiff_plain;h=fcc4134a7b76d82d39dea635c41ec593a41d6d19
[JOBS] Do not close stderr when /dev/tty fails to open
As it stands if we fail to open /dev/tty we end up closing stderr
after saving it at a higher fd.
Thanks to David van Gorkom for reporting this.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
diff --git a/src/jobs.c b/src/jobs.c
index 69a84f7..b1ab7ab 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -195,6 +195,9 @@ setjobctl(int on)
while (!isatty(fd))
if (--fd < 0)
goto out;
+ fd = dup(fd);
+ if (fd < 0)
+ goto out;
}
fd = savefd(fd);
do { /* while we are in the background */