1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-30 06:25:25 +03:00

[PATCH] Don't use any syslog() in signal handler, cause it may deadlock.

This commit is contained in:
kay.sievers@vrfy.org 2004-11-05 13:16:32 +01:00 committed by Greg KH
parent a5d00f9d37
commit 5a73b25fd6
3 changed files with 4 additions and 12 deletions

5
udev.c
View File

@ -65,14 +65,10 @@ static void asmlinkage sig_handler(int signum)
switch (signum) {
case SIGALRM:
gotalarm = 1;
info("error: timeout reached, event probably not handled correctly");
break;
case SIGINT:
case SIGTERM:
udevdb_exit();
exit(20 + signum);
default:
dbg("unhandled signal %d", signum);
}
}
@ -148,6 +144,7 @@ int main(int argc, char *argv[], char *envp[])
/* set signal handlers */
act.sa_handler = (void (*) (int))sig_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
/* alarm must not restart syscalls*/
sigaction(SIGALRM, &act, NULL);
sigaction(SIGINT, &act, NULL);

2
udev.h
View File

@ -26,7 +26,7 @@
#include <sys/param.h>
#include "libsysfs/sysfs/libsysfs.h"
#define ALARM_TIMEOUT 30
#define ALARM_TIMEOUT 120
#define COMMENT_CHARACTER '#'
#define NAME_SIZE 256

View File

@ -327,20 +327,15 @@ static void asmlinkage sig_handler(int signum)
sigchilds_waiting = 1;
goto do_write;
break;
default:
dbg("unhandled signal %d", signum);
return;
}
do_write:
/* if pipe is empty, write to pipe to force select to return
* immediately when it gets called
*/
if (!sig_flag) {
rc = write(pipefds[1],&signum,sizeof(signum));
if (rc < 0)
dbg("unable to write to pipe");
else
if (rc >= 0)
sig_flag = 1;
}
}