chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rules: use encoded strings instead of skipping characters
[elogind.git]
/
udevstart.c
diff --git
a/udevstart.c
b/udevstart.c
index 11bdf791832759a9c8cd929b8bc448fe7b1a5fb1..a381c411a80f437157ed38a622723f52ba531041 100644
(file)
--- 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 <harald@redhat.com>
* Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004 Kay Sievers <kay@vrfy.org>
- *
- * 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 <harald@redhat.com>
+ * Copyright (C) 2004-2006 Kay Sievers <kay@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
*
* 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.,
*
* 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.
*
*/
*
*/
@@
-40,6
+36,7
@@
#include "udev.h"
#include "udev_rules.h"
#include "udev.h"
#include "udev_rules.h"
+#include "udev_selinux.h"
static const char *udev_run_str;
static const char *udev_log_str;
static const char *udev_run_str;
static const char *udev_log_str;
@@
-108,6
+105,7
@@
static int add_device(const char *devpath)
{
struct sysfs_device *dev;
struct udevice *udev;
{
struct sysfs_device *dev;
struct udevice *udev;
+ int retval = 0;
/* clear and set environment for next event */
clearenv();
/* clear and set environment for next event */
clearenv();
@@
-122,14
+120,13
@@
static int add_device(const char *devpath)
if (dev == NULL)
return -1;
if (dev == NULL)
return -1;
- udev = udev_device_init();
+ udev = udev_device_init(
NULL
);
if (udev == NULL)
return -1;
/* override built-in sysfs device */
udev->dev = dev;
strcpy(udev->action, "add");
if (udev == NULL)
return -1;
/* override built-in sysfs device */
udev->dev = dev;
strcpy(udev->action, "add");
- udev->devt = udev_device_get_devt(udev);
if (strcmp(udev->dev->subsystem, "net") != 0) {
udev->devt = udev_device_get_devt(udev);
if (strcmp(udev->dev->subsystem, "net") != 0) {
udev->devt = udev_device_get_devt(udev);
@@
-146,14
+143,12
@@
static int add_device(const char *devpath)
dbg("device event will be ignored");
goto exit;
}
dbg("device event will be ignored");
goto exit;
}
- if (udev->name[0]
== '\0') {
-
dbg("device node creation supressed"
);
- goto run;
- }
+ if (udev->name[0]
!= '\0')
+
retval = udev_device_event(&rules, udev
);
+ else
+ info("device node creation supressed");
- udev_add_device(udev);
-run:
- if (udev_run && !list_empty(&udev->run_list)) {
+ if (retval == 0 && udev_run) {
struct name_entry *name_loop;
dbg("executing run list");
struct name_entry *name_loop;
dbg("executing run list");
@@
-164,14
+159,14
@@
run:
char program[PATH_SIZE];
strlcpy(program, name_loop->name, sizeof(program));
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));
}
}
}
run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
}
}
}
+
exit:
udev_device_cleanup(udev);
exit:
udev_device_cleanup(udev);
-
return 0;
}
return 0;
}
@@
-341,6
+336,7
@@
int main(int argc, char *argv[], char *envp[])
logging_init("udevstart");
udev_config_init();
logging_init("udevstart");
udev_config_init();
+ selinux_init();
dbg("version %s", UDEV_VERSION);
udev_run_str = getenv("UDEV_RUN");
dbg("version %s", UDEV_VERSION);
udev_run_str = getenv("UDEV_RUN");
@@
-371,6
+367,7
@@
int main(int argc, char *argv[], char *envp[])
udev_rules_cleanup(&rules);
sysfs_cleanup();
udev_rules_cleanup(&rules);
sysfs_cleanup();
+ selinux_exit();
logging_close();
return 0;
}
logging_close();
return 0;
}