summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-07-07 19:48:14 +0000
committerRoy Marples <uberlord@gentoo.org>2007-07-07 19:48:14 +0000
commitbf51445e44678e2d0893855644da610d136ae62c (patch)
tree8d2fa5bced4bd095645b10055f5880e2e11df418 /sys-libs/gpm/files
parentStable on ppc; bug #184462. (diff)
downloadgentoo-2-bf51445e44678e2d0893855644da610d136ae62c.tar.gz
gentoo-2-bf51445e44678e2d0893855644da610d136ae62c.tar.bz2
gentoo-2-bf51445e44678e2d0893855644da610d136ae62c.zip
Close stdin, stdout and stderr after forking, #182721.
(Portage version: 2.1.3_rc6)
Diffstat (limited to 'sys-libs/gpm/files')
-rw-r--r--sys-libs/gpm/files/digest-gpm-1.20.1-r66
-rw-r--r--sys-libs/gpm/files/gpm-daemon.patch48
2 files changed, 54 insertions, 0 deletions
diff --git a/sys-libs/gpm/files/digest-gpm-1.20.1-r6 b/sys-libs/gpm/files/digest-gpm-1.20.1-r6
new file mode 100644
index 000000000000..0083e96a72bb
--- /dev/null
+++ b/sys-libs/gpm/files/digest-gpm-1.20.1-r6
@@ -0,0 +1,6 @@
+MD5 ede95b6eb848f87440a2d7f86eaaf13a gpm-1.20.1-patches-1.4.tar.bz2 8049
+RMD160 9bf31260db39870a678ed1167c0b242a778b2b61 gpm-1.20.1-patches-1.4.tar.bz2 8049
+SHA256 64d68412c95358f7d3a525dce38661aa53f13c0ddf2e20eb869325e8dd170e07 gpm-1.20.1-patches-1.4.tar.bz2 8049
+MD5 2c63e827d755527950d9d13fe3d87692 gpm-1.20.1.tar.bz2 565014
+RMD160 2650ae1e3e87fcf8bdad80acf62777e8a62b6582 gpm-1.20.1.tar.bz2 565014
+SHA256 11fabe7f27a205ff1ea6aee23e1dc2bb2dc5dbfc45ff0320fca0cd559806a936 gpm-1.20.1.tar.bz2 565014
diff --git a/sys-libs/gpm/files/gpm-daemon.patch b/sys-libs/gpm/files/gpm-daemon.patch
new file mode 100644
index 000000000000..75bbb9945c49
--- /dev/null
+++ b/sys-libs/gpm/files/gpm-daemon.patch
@@ -0,0 +1,48 @@
+Daemons should always close stdin, stdout and stderr after forking otherwise
+the controlling terminal will have issues closing.
+Examples include starting over ssh or baselayout-2
+http://bugs.gentoo.org/show_bug.cgi?id=182721
+
+diff -ur a/src/startup.c b/src/startup.c
+--- a/src/startup.c 2002-12-24 22:57:16.000000000 +0000
++++ b/src/startup.c 2007-07-06 23:33:50.000000000 +0100
+@@ -29,7 +29,7 @@
+ #include <sys/types.h> /* geteuid, mknod */
+ #include <sys/stat.h> /* mknod */
+ #include <fcntl.h> /* mknod */
+-#include <unistd.h> /* mknod */
++#include <unistd.h> /* mknod, daemon */
+
+
+ #include "headers/gpmInt.h"
+@@ -134,26 +134,17 @@
+ }
+ }
+
+- if(option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
+- /* goto background and become a session leader (Stefan Giessler) */
+- switch(fork()) {
+- case -1: gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
+- case 0: option.run_status = GPM_RUN_DAEMON; break; /* child */
+- default: _exit(0); /* parent */
+- }
++ if (option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
++ if (daemon(0,0))
++ gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
+
+- if (setsid() < 0) gpm_report(GPM_PR_OOPS,GPM_MESS_SETSID_FAILED);
++ option.run_status = GPM_RUN_DAEMON; /* child */
+ }
+
+ /* damon init: check whether we run or not, display message */
+ check_uniqueness();
+ gpm_report(GPM_PR_INFO,GPM_MESS_STARTED);
+
+- /* is changing to root needed, because of relative paths ? or can we just
+- * remove and ignore it ?? FIXME */
+- if (chdir("/") < 0) gpm_report(GPM_PR_OOPS,GPM_MESS_CHDIR_FAILED);
+-
+-
+ //return mouse_table[1].fd; /* the second is handled in the main() */
+
+ /****************** OLD CODE from gpn.c END ***********************/