/*
- * udev.c
- *
* Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
*
* 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
*
* 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.
*
*/
#include "udev.h"
#include "udev_rules.h"
+#include "udev_selinux.h"
#ifdef USE_LOG
void log_message(int priority, const char *format, ...)
exit(0);
}
- /* set std fd's to /dev/null, if the kernel forks us, we don't have them at all */
+ /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */
devnull = open("/dev/null", O_RDWR);
if (devnull >= 0) {
if (devnull != STDIN_FILENO)
logging_init("udev");
if (devnull < 0)
- err("fatal, could not open /dev/null: %s", strerror(errno));
+ err("open /dev/null failed: %s", strerror(errno));
udev_config_init();
+ selinux_init();
dbg("version %s", UDEV_VERSION);
/* set signal handlers */
retval = udev_device_event(&rules, udev);
- if (!retval && udev_run && !list_empty(&udev->run_list)) {
+ if (retval == 0 && !udev->ignore_device && udev_run) {
struct name_entry *name_loop;
dbg("executing run list");
char program[PATH_SIZE];
strlcpy(program, name_loop->name, sizeof(program));
- apply_format(udev, program, sizeof(program));
+ udev_rules_apply_format(udev, program, sizeof(program));
run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
}
}
exit:
logging_close();
- return retval;
+ if (retval != 0)
+ return 1;
+ return 0;
}