tags 483805 patch
thanks

Hi,

stumbled across the same bug. The problem is, that acpid connects
stdout and stderr to /dev/null (only in daemon mode), but it
opens /dev/null read-only. 

Thus, any output in /etc/init.d/gdm will fail, and as the script most
probably does a ``set -e'', it fails altogether.

The attached patch fixes this. 

In the meantime, you can work around the bug, by creating the
following script as /etc/acpi/restart_gdm.sh:

#!/bin/sh

/etc/init.d/gdm restart > /dev/null 2>&1 < /dev/null

and setting ``action=/etc/acpi/restart_gdm.sh''. Or, more generally,
put the following line in any script in /etc/acpi at the top:

#!/bin/sh
exec > /dev/null 2>&1 < /dev/null
#...

Cheers,
harry
diff -Nru a/acpid.c b/acpid.c
--- a/acpid.c	2008-11-03 14:04:43.000000000 +0100
+++ b/acpid.c	2008-12-19 18:38:14.291127677 +0100
@@ -456,7 +456,7 @@
 	int log_opts;
 
 	/* open /dev/null */
-	nullfd = open("/dev/null", O_RDONLY);
+	nullfd = open("/dev/null", O_RDWR);
 	if (nullfd < 0) {
 		fprintf(stderr, "%s: can't open %s: %s\n", progname, 
 			"/dev/null", strerror(errno));

Attachment: signature.asc
Description: PGP signature

Reply via email to