ALT Linux Bugzilla
– Attachment 14546 Details for
Bug 37201
50-udev-default.rules no effect при загрузке с propagator
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
udev.c: redirect udev messages to /var/log/udevd.log
0001-udev.c-redirect-udev-messages-to-var-log-udevd.log.patch (text/plain), 2.48 KB, created by
Leonid Krivoshein
on 2023-09-25 00:15:19 MSK
(
hide
)
Description:
udev.c: redirect udev messages to /var/log/udevd.log
Filename:
MIME Type:
Creator:
Leonid Krivoshein
Created:
2023-09-25 00:15:19 MSK
Size:
2.48 KB
patch
obsolete
>From 47986995dec30eec382ebad67d0d59907fe6df23 Mon Sep 17 00:00:00 2001 >From: Leonid Krivoshein <klark@altlinux.org> >Date: Mon, 25 Sep 2023 00:07:27 +0300 >Subject: [PATCH 1/1] udev.c: redirect udev messages to /var/log/udevd.log > >--- > udev.c | 55 +++++++++++++++++++++++++++++-------------------------- > 1 file changed, 29 insertions(+), 26 deletions(-) > >diff --git a/udev.c b/udev.c >index 0c211a9..e64dd0a 100644 >--- a/udev.c >+++ b/udev.c >@@ -19,13 +19,14 @@ > * > */ > >+#define _GNU_SOURCE > #include <errno.h> > #include <string.h> > #include <stdlib.h> > #include <stdio.h> >+#include <fcntl.h> > #include <unistd.h> > #include <dirent.h> >-#include <fcntl.h> > #include <limits.h> > #include <sys/stat.h> > #include <sys/vfs.h> >@@ -49,17 +50,7 @@ extern char * const env[]; > static pid_t udevd_pid; > > >-static void spawn_wait(char * const command[], const char *message) >-{ >- int status = 0; >- >- if (waitpid(spawn(command), &status, 0) < 0 || !(WIFEXITED(status))) { >- warn(message); >- } >-} >- >- >-static void spawn_silent(char * const command[]) >+static pid_t spawn_silent(char * const command[], const char *log) > { > int fd = 0; > pid_t pid = fork(); >@@ -67,19 +58,31 @@ static void spawn_silent(char * const command[]) > if (pid < 0) > fatal(command[0]); > else if (pid == 0) { >- fd = open("/dev/null", O_WRONLY, 0666); >- if (fd >= 0) { >- dup2(fd, 1); >- dup2(fd, 2); >- close(fd); >- } >+ if (log) >+ fd = creat(log, 0640); >+ else >+ fd = open(log = "/dev/null", O_WRONLY, 0644); >+ if (fd < 0) >+ fatal(log); >+ close(1); >+ close(2); >+ dup3(fd, 1, O_CLOEXEC); >+ dup3(1, 2, O_CLOEXEC); >+ close(fd); > execve(command[0], &command[1], env); >- perror(command[0]); >- exit(1); >+ fatal(command[0]); > } > >- if (waitpid(pid, &fd, 0) >= 0) { >- fd = WIFEXITED(fd); >+ return pid; >+} >+ >+ >+static void spawn_wait(char * const command[], const char *message) >+{ >+ int status = 0; >+ >+ if (waitpid(spawn_silent(command, NULL), &status, 0) < 0 || !(WIFEXITED(status))) { >+ warn(message); > } > } > >@@ -105,16 +108,16 @@ void udev_start(void) > > printf("Spawning udevd... "); > >- udevd_pid = spawn(udevd); >+ udevd_pid = spawn_silent(udevd, "/var/log/udevd.log"); > spawn_wait(priority, "udev_priority"); > spawn_wait(startup, "udev_startup"); >- spawn_silent(reload); >+ spawn_silent(reload, NULL); > > if (mkdir_dev(".udev/queue") < 0) > fatal("cannot create /dev/.udev/queue"); > >- spawn_silent(subsys); >- spawn_silent(devices); >+ spawn_silent(subsys, NULL); >+ spawn_silent(devices, NULL); > udev_settle(); > > printf("done\n"); >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37201
:
8287
|
14456
| 14546