From: Kay Sievers Date: Sun, 28 Jun 2009 00:21:58 +0000 (+0200) Subject: do not exports properties starting with a '.' X-Git-Tag: 174~925 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b25a94549ce37cd7654f6f44b66944375919db58;p=systemd do not exports properties starting with a '.' Private variables can be marked like: ENV{.FOO}="bar" --- diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 669c51e3..951f78aa 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1211,14 +1211,20 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) s = udev_device->monitor_buf; l = MONITOR_BUF_SIZE; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + const char *key; + + key = udev_list_entry_get_name(list_entry); + /* skip private variables */ + if (key[0] == '.') + continue; + /* add string to envp array */ udev_device->envp[i++] = s; if (i+1 >= ENVP_SIZE) return -EINVAL; /* add property string to monitor buffer */ - l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), "=", - udev_list_entry_get_value(list_entry), NULL); + l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); if (l == 0) return -EINVAL; s++; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 174edfd9..96d73774 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -718,8 +718,9 @@ static int import_property_from_string(struct udev_device *dev, char *line) struct udev_list_entry *entry; entry = udev_device_add_property(dev, key, val); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_flag(entry, 1); } return 0; } @@ -785,8 +786,9 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi dbg(udev, "import key '%s=%s'\n", key, val); entry = udev_device_add_property(dev, key, val); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_flag(entry, 1); } } return 0; @@ -2374,8 +2376,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_flag(entry, 1); } else { udev_device_add_property(event->dev, name, NULL); }