chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] update Fedora dev.d/ example and remove unused conf.d/ directory
[elogind.git]
/
udev.c
diff --git
a/udev.c
b/udev.c
index 847cc5dade49bdf177082e5f8a4ae88110e70c9d..507f2be943a88e9142bc802f0f4da0ac95e53aa6 100644
(file)
--- a/
udev.c
+++ b/
udev.c
@@
-61,6
+61,10
@@
static int manage_hotplug_event(void) {
int fd;
int len;
int fd;
int len;
+ /* false, if we are called directly */
+ if (!getenv("MANAGED_EVENT"))
+ goto exit;
+
fd = open("/proc/sys/kernel/hotplug", O_RDONLY);
if (fd < 0)
goto exit;
fd = open("/proc/sys/kernel/hotplug", O_RDONLY);
if (fd < 0)
goto exit;
@@
-111,17
+115,22
@@
int main(int argc, char *argv[], char *envp[])
act.sa_handler = (void (*) (int))sig_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
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);
sigaction(SIGTERM, &act, NULL);
sigaction(SIGALRM, &act, NULL);
sigaction(SIGINT, &act, NULL);
sigaction(SIGTERM, &act, NULL);
- /* trigger timeout to
interrupt blocking syscall
s */
+ /* trigger timeout to
prevent hanging processe
s */
alarm(ALARM_TIMEOUT);
alarm(ALARM_TIMEOUT);
+ action = getenv("ACTION");
+ devpath = getenv("DEVPATH");
+ subsystem = getenv("SUBSYSTEM");
+ /* older kernels passed the SUBSYSTEM only as argument */
+ if (!subsystem && argc == 2)
+ subsystem = argv[1];
udev_init_device(&udev, devpath, subsystem);
udev_init_device(&udev, devpath, subsystem);
- if (strstr(argv[0], "udevstart") || (arg
v[1] != NULL
&& strstr(argv[1], "udevstart"))) {
+ if (strstr(argv[0], "udevstart") || (arg
c == 2
&& strstr(argv[1], "udevstart"))) {
dbg("udevstart");
/* disable all logging, as it's much too slow on some facilities */
dbg("udevstart");
/* disable all logging, as it's much too slow on some facilities */