chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge libudev, udev, and the unconditional extras in a single Makefile.am.
[elogind.git]
/
libudev
/
libudev-device.c
diff --git
a/libudev/libudev-device.c
b/libudev/libudev-device.c
index 669c51e35bb7617f24bfb153d0b4061003603dda..9d1e546c83dd304c84484cc21585a27726b092bb 100644
(file)
--- a/
libudev/libudev-device.c
+++ b/
libudev/libudev-device.c
@@
-961,7
+961,7
@@
unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
* @udev_device: udev device
* @sysattr: attribute name
*
* @udev_device: udev device
* @sysattr: attribute name
*
- * The retrieved value is cached in the device. Repeated
read
s will return the same
+ * The retrieved value is cached in the device. Repeated
call
s will return the same
* value and not open the attribute again.
*
* Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value.
* value and not open the attribute again.
*
* Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value.
@@
-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)) {
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 */
/* 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++;
if (l == 0)
return -EINVAL;
s++;
@@
-1276,6
+1282,7
@@
const char *udev_device_get_devpath_old(struct udev_device *udev_device)
int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old)
{
int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old)
{
+ free(udev_device->devpath_old);
udev_device->devpath_old = strdup(devpath_old);
if (udev_device->devpath_old == NULL)
return -ENOMEM;
udev_device->devpath_old = strdup(devpath_old);
if (udev_device->devpath_old == NULL)
return -ENOMEM;
@@
-1290,9
+1297,11
@@
const char *udev_device_get_knodename(struct udev_device *udev_device)
int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename)
{
int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename)
{
+ free(udev_device->knodename);
udev_device->knodename = strdup(knodename);
if (udev_device->knodename == NULL)
return -ENOMEM;
udev_device->knodename = strdup(knodename);
if (udev_device->knodename == NULL)
return -ENOMEM;
+ udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename);
return 0;
}
return 0;
}