summaryrefslogtreecommitdiff
path: root/udevd.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2007-04-26 22:52:20 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-04-26 22:52:20 +0200
commit1343a9524f9d2145dfbf2ba479eb859faf6a1e95 (patch)
treeb5160986162c72a36167469f2add6483e6251533 /udevd.c
parent01ad1ef5f367f1e3e777d03f08b78a1fc37a8f05 (diff)
udevcontrol: allow to set global variables in udevd
The initial patch is from Harald, possible new bugs are from me.
Diffstat (limited to 'udevd.c')
-rw-r--r--udevd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/udevd.c b/udevd.c
index dccc745eff..645b068c0e 100644
--- a/udevd.c
+++ b/udevd.c
@@ -667,6 +667,7 @@ static void get_ctrl_msg(void)
struct ucred *cred;
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
int *intval;
+ char *pos;
memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg));
iov.iov_base = &ctrl_msg;
@@ -703,6 +704,21 @@ static void get_ctrl_msg(void)
}
switch (ctrl_msg.type) {
+ case UDEVD_CTRL_ENV:
+ pos = strchr(ctrl_msg.buf, '=');
+ if (pos == NULL) {
+ err("wrong key format '%s'", ctrl_msg.buf);
+ break;
+ }
+ pos[0] = '\0';
+ if (pos[1] == '\0') {
+ info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf);
+ unsetenv(ctrl_msg.buf);
+ } else {
+ info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]);
+ setenv(ctrl_msg.buf, &pos[1], 1);
+ }
+ break;
case UDEVD_CTRL_STOP_EXEC_QUEUE:
info("udevd message (STOP_EXEC_QUEUE) received");
stop_exec_q = 1;