- replace OPEN_MAX with sysconf(_SC_OPEN_MAX), fixing build with 2.6.23

kernel
This commit is contained in:
Tomas Janousek 2007-07-24 18:51:40 +00:00
parent 1a32313cf8
commit 11b8ab3f77
2 changed files with 32 additions and 1 deletions

26
gpm-1.20.1-openmax.patch Normal file
View File

@ -0,0 +1,26 @@
--- gpm-1.20.1/src/prog/gpm-root.y.openmax 2002-12-24 23:57:16.000000000 +0100
+++ gpm-1.20.1/src/prog/gpm-root.y 2007-07-24 20:45:46.000000000 +0200
@@ -525,7 +525,9 @@
open("/dev/null",O_RDONLY); /* stdin */
open(consolename,O_WRONLY); /* stdout */
dup(1); /* stderr */
- for (i=3;i<OPEN_MAX; i++) close(i);
+ int open_max = sysconf(_SC_OPEN_MAX);
+ if (open_max == -1) open_max = 1024;
+ for (i=3;i<open_max; i++) close(i);
execl("/bin/sh","sh","-c",self->arg,(char *)NULL);
exit(1); /* shouldn't happen */
default: return 0;
--- gpm-1.20.1/src/special.c.openmax 2007-07-24 20:45:46.000000000 +0200
+++ gpm-1.20.1/src/special.c 2007-07-24 20:45:46.000000000 +0200
@@ -156,7 +156,9 @@
open(GPM_NULL_DEV,O_RDONLY); /* stdin */
open(console.device, O_WRONLY); /* stdout */
dup(1); /* stderr */
- for (i=3;i<OPEN_MAX; i++) close(i);
+ int open_max = sysconf(_SC_OPEN_MAX);
+ if (open_max == -1) open_max = 1024;
+ for (i=3;i<open_max; i++) close(i);
execl("/bin/sh","sh","-c",command,(char *)NULL);
exit(1); /* shouldn't happen */

View File

@ -1,7 +1,7 @@
Summary: A mouse server for the Linux console.
Name: gpm
Version: 1.20.1
Release: 86%{?dist}
Release: 87%{?dist}
License: GPL
Group: System Environment/Daemons
Source: http://ftp.linux.it/pub/People/rubini/gpm/%{name}-%{version}.tar.gz
@ -24,6 +24,7 @@ Patch23: gpm-1.20.1-aligned-sleep.patch
Patch24: gpm-1.20.1-deadsocket.patch
Patch25: gpm-1.20.1-default-handler.patch
Patch26: gpm-1.20.1-va_list.patch
Patch27: gpm-1.20.1-openmax.patch
Prereq: /sbin/chkconfig /sbin/ldconfig /sbin/install-info
Requires: bash >= 2.0
@ -72,6 +73,7 @@ mouse button.
%patch24 -p1 -b .deadsocket
%patch25 -p1 -b .default-handler
%patch26 -p1 -b .va_list
%patch27 -p1 -b .openmax
%build
rm -f configure
@ -191,6 +193,9 @@ fi
%{_libdir}/libgpm.so
%changelog
* Tue Jul 24 2007 Tomas Janousek <tjanouse@redhat.com> - 1.20.1-87
- replace OPEN_MAX with sysconf(_SC_OPEN_MAX), fixing build with 2.6.23 kernel
* Tue Jul 24 2007 Tomas Janousek <tjanouse@redhat.com> - 1.20.1-86
- don't install t-mouse.el, emacs-common contains a newer version,
fixes #249362