X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udevstart.c;h=66b96a218654edffefb7e15bbdcfd719cfd6363f;hp=d0a1ded2be069cf16d0f8931a840f272875702d2;hb=6d86cda476fd519105e642afae01fff5fc1a3e29;hpb=eef7c9a385575375a3e3310900022b37777aeb6c diff --git a/udevstart.c b/udevstart.c index d0a1ded2b..66b96a218 100644 --- a/udevstart.c +++ b/udevstart.c @@ -1,13 +1,9 @@ /* - * udevstart.c + * quick and dirty way to populate a /dev directory * + * Copyright (C) 2004 Harald Hoyer * Copyright (C) 2004 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * Quick and dirty way to populate a /dev with udev if your system - * does not have access to a shell. Based originally on a patch - * from: - * Harald Hoyer + * Copyright (C) 2004-2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -20,7 +16,7 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -72,7 +68,7 @@ static int device_list_insert(const char *path, struct list_head *device_list) struct device *new_device; const char *devpath = &path[strlen(sysfs_path)]; - dbg("insert: '%s'\n", devpath); + dbg("insert: '%s'", devpath); list_for_each_entry(loop_device, device_list, node) { if (strcmp(loop_device->path, devpath) > 0) { @@ -124,7 +120,7 @@ static int add_device(const char *devpath) if (dev == NULL) return -1; - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) return -1; @@ -152,22 +148,8 @@ static int add_device(const char *devpath) else info("device node creation supressed"); - if (retval == 0 && udev_run) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, "add"); - else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); - } - } - } + if (retval == 0 && udev_run) + udev_rules_run(udev); exit: udev_device_cleanup(udev); @@ -371,6 +353,7 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_cleanup(&rules); sysfs_cleanup(); + selinux_exit(); logging_close(); return 0; }