summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorScott James Remnant <scott@ubuntu.com>2009-01-20 21:33:02 +0000
committerScott James Remnant <scott@netsplit.com>2009-01-20 21:33:02 +0000
commit5f03ed8a56d308af72db8a48ab66ed68667af2c6 (patch)
tree0677da5f63eeb76c8da17da2162e555ef1a80a10 /udev/udevd.c
parentfc7d16f993df6cef0e6038c63942d17994fde672 (diff)
Allow user and group lookup to be disabled.
In certain cut-down situations such as an installer or inside the initramfs, we simply don't have any kind of name service. While we could use rules without OWNER or GROUP, it's better to have the same rules as a full system and have udevd ignore those parts of the rules. Adds a --resolve-names=never switch to udevd that has this effect.
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 993964d23d..9a8d791800 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -639,12 +639,14 @@ int main(int argc, char *argv[])
fd_set readfds;
const char *value;
int daemonize = 0;
+ int resolve_names = 1;
static const struct option options[] = {
{ "daemon", no_argument, NULL, 'd' },
{ "debug-trace", no_argument, NULL, 't' },
{ "debug", no_argument, NULL, 'D' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
+ { "resolve-names", required_argument, NULL, 'N' },
{}
};
int rc = 1;
@@ -678,8 +680,19 @@ int main(int argc, char *argv[])
if (udev_get_log_priority(udev) < LOG_INFO)
udev_set_log_priority(udev, LOG_INFO);
break;
+ case 'N':
+ if (strcmp (optarg, "early") == 0) {
+ resolve_names = 1;
+ } else if (strcmp (optarg, "never") == 0) {
+ resolve_names = -1;
+ } else {
+ fprintf(stderr, "resolve-names must be early or never\n");
+ err(udev, "resolve-names must be early or never\n");
+ goto exit;
+ }
+ break;
case 'h':
- printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n");
+ printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|never] [--version]\n");
goto exit;
case 'V':
printf("%s\n", VERSION);
@@ -759,7 +772,7 @@ int main(int argc, char *argv[])
goto exit;
}
- rules = udev_rules_new(udev, 1);
+ rules = udev_rules_new(udev, resolve_names);
if (rules == NULL) {
err(udev, "error reading rules\n");
goto exit;
@@ -957,7 +970,7 @@ int main(int argc, char *argv[])
struct udev_rules *rules_new;
reload_config = 0;
- rules_new = udev_rules_new(udev, 1);
+ rules_new = udev_rules_new(udev, resolve_names);
if (rules_new != NULL) {
udev_rules_unref(rules);
rules = rules_new;