mirror of
https://github.com/systemd/systemd.git
synced 2025-01-13 17:18:18 +03:00
[PATCH] export udev_log flag to the environment
Forked scripts and callouts may want to follow udev's configured behavior and log only if udev is logging itself.
This commit is contained in:
parent
7a0643a93f
commit
69d2dbd66f
10
udev.c
10
udev.c
@ -81,6 +81,10 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
logging_init("udev");
|
logging_init("udev");
|
||||||
udev_init_config();
|
udev_init_config();
|
||||||
|
|
||||||
|
/* export logging flag, callouts may want to do the same as udev */
|
||||||
|
if (udev_log)
|
||||||
|
setenv("UDEV_LOG", "1", 1);
|
||||||
|
|
||||||
if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) {
|
if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) {
|
||||||
act_type = UDEVSTART;
|
act_type = UDEVSTART;
|
||||||
} else {
|
} else {
|
||||||
@ -143,7 +147,11 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
switch(act_type) {
|
switch(act_type) {
|
||||||
case UDEVSTART:
|
case UDEVSTART:
|
||||||
dbg("udevstart");
|
dbg("udevstart");
|
||||||
|
|
||||||
|
/* disable all logging as it's much too slow on some facilities */
|
||||||
udev_log = 0;
|
udev_log = 0;
|
||||||
|
unsetenv("UDEV_LOG");
|
||||||
|
|
||||||
namedev_init();
|
namedev_init();
|
||||||
retval = udev_start();
|
retval = udev_start();
|
||||||
break;
|
break;
|
||||||
@ -155,7 +163,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
class_dev = sysfs_open_class_device_path(path);
|
class_dev = sysfs_open_class_device_path(path);
|
||||||
if (class_dev == NULL) {
|
if (class_dev == NULL) {
|
||||||
dbg ("sysfs_open_class_device_path failed");
|
dbg ("sysfs_open_class_device_path failed");
|
||||||
break;
|
goto exit;
|
||||||
}
|
}
|
||||||
dbg("opened class_dev->name='%s'", class_dev->name);
|
dbg("opened class_dev->name='%s'", class_dev->name);
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ int udev_start(void)
|
|||||||
{
|
{
|
||||||
/* set environment for callouts and dev.d/ */
|
/* set environment for callouts and dev.d/ */
|
||||||
setenv("ACTION", "add", 1);
|
setenv("ACTION", "add", 1);
|
||||||
setenv("UDEVSTART", "1", 1);
|
setenv("UDEV_START", "1", 1);
|
||||||
|
|
||||||
udev_scan_class();
|
udev_scan_class();
|
||||||
udev_scan_block();
|
udev_scan_block();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user