1 |
phreak 07/11/01 19:09:23 |
2 |
|
3 |
Added: gpm-OPEN_MAX.patch |
4 |
Log: |
5 |
Add patch by Tomas Janousek to fix compilation against linux-headers-2.6.23 (see #195977). |
6 |
(Portage version: 2.1.3.9) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 sys-libs/gpm/files/gpm-OPEN_MAX.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/gpm/files/gpm-OPEN_MAX.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/gpm/files/gpm-OPEN_MAX.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: gpm-OPEN_MAX.patch |
15 |
=================================================================== |
16 |
Daemons should always close stdin, stdout and stderr after forking otherwise |
17 |
the controlling terminal will have issues closing. |
18 |
Examples include starting over ssh or baselayout-2 |
19 |
http://bugs.gentoo.org/show_bug.cgi?id=182721 |
20 |
|
21 |
|
22 |
diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y |
23 |
index 3a97602..b496550 100644 |
24 |
--- a/src/prog/gpm-root.y |
25 |
+++ b/src/prog/gpm-root.y |
26 |
@@ -526,7 +526,9 @@ int f_bgcmd(int mode, DrawItem *self, int uid) |
27 |
open("/dev/null",O_RDONLY); /* stdin */ |
28 |
open(consolename,O_WRONLY); /* stdout */ |
29 |
dup(1); /* stderr */ |
30 |
- for (i=3;i<OPEN_MAX; i++) close(i); |
31 |
+ int open_max = sysconf(_SC_OPEN_MAX); |
32 |
+ if (open_max == -1) open_max = 1024; |
33 |
+ for (i=3;i<open_max; i++) close(i); |
34 |
execl("/bin/sh","sh","-c",self->arg,(char *)NULL); |
35 |
exit(1); /* shouldn't happen */ |
36 |
default: return 0; |
37 |
diff --git a/src/special.c b/src/special.c |
38 |
index 5bed91a..c6cd04d 100644 |
39 |
--- a/src/special.c |
40 |
+++ b/src/special.c |
41 |
@@ -156,7 +156,9 @@ int processSpecial(Gpm_Event *event) |
42 |
open(GPM_NULL_DEV,O_RDONLY); /* stdin */ |
43 |
open(console.device, O_WRONLY); /* stdout */ |
44 |
dup(1); /* stderr */ |
45 |
- for (i=3;i<OPEN_MAX; i++) close(i); |
46 |
+ int open_max = sysconf(_SC_OPEN_MAX); |
47 |
+ if (open_max == -1) open_max = 1024; |
48 |
+ for (i=3;i<open_max; i++) close(i); |
49 |
execl("/bin/sh","sh","-c",command,(char *)NULL); |
50 |
exit(1); /* shouldn't happen */ |
51 |
|
52 |
|
53 |
-- |
54 |
gentoo-commits@g.o mailing list |