chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix double semicolon typo
[elogind.git]
/
src
/
libelogind
/
sd-device
/
sd-device.c
diff --git
a/src/libelogind/sd-device/sd-device.c
b/src/libelogind/sd-device/sd-device.c
index 97da4a8eea0d33a981439ed82f450e5377680b0c..8e63b9ef560921b0bdedcf266e0483b88dedc286 100644
(file)
--- a/
src/libelogind/sd-device/sd-device.c
+++ b/
src/libelogind/sd-device/sd-device.c
@@
-785,7
+785,7
@@
_public_ int sd_device_get_subsystem(sd_device *device, const char **ret) {
path_startswith(device->devpath, "/class/") ||
path_startswith(device->devpath, "/bus/"))
r = device_set_subsystem(device, "subsystem");
path_startswith(device->devpath, "/class/") ||
path_startswith(device->devpath, "/bus/"))
r = device_set_subsystem(device, "subsystem");
- if (r < 0)
+ if (r < 0
&& r != -ENOENT
)
return log_debug_errno(r, "sd-device: could not set subsystem for %s: %m", device->devpath);
device->subsystem_set = true;
return log_debug_errno(r, "sd-device: could not set subsystem for %s: %m", device->devpath);
device->subsystem_set = true;
@@
-901,8
+901,11
@@
_public_ int sd_device_get_driver(sd_device *device, const char **ret) {
if (r >= 0) {
r = device_set_driver(device, driver);
if (r < 0)
if (r >= 0) {
r = device_set_driver(device, driver);
if (r < 0)
- return r;
- }
+ return log_debug_errno(r, "sd-device: could not set driver for %s: %m", device->devpath);
+ } else if (r == -ENOENT)
+ device->driver_set = true;
+ else
+ return log_debug_errno(r, "sd-device: could not set driver for %s: %m", device->devpath);
}
*ret = device->driver;
}
*ret = device->driver;
@@
-1188,6
+1191,8
@@
int device_get_id_filename(sd_device *device, const char **ret) {
return r;
if (major(devnum) > 0) {
return r;
if (major(devnum) > 0) {
+ assert(subsystem);
+
/* use dev_t -- b259:131072, c254:0 */
r = asprintf(&id, "%c%u:%u",
streq(subsystem, "block") ? 'b' : 'c',
/* use dev_t -- b259:131072, c254:0 */
r = asprintf(&id, "%c%u:%u",
streq(subsystem, "block") ? 'b' : 'c',
@@
-1209,6
+1214,9
@@
int device_get_id_filename(sd_device *device, const char **ret) {
if (!sysname)
return -EINVAL;
if (!sysname)
return -EINVAL;
+ if (!subsystem)
+ return -EINVAL;
+
r = asprintf(&id, "+%s:%s", subsystem, sysname);
if (r < 0)
return -ENOMEM;
r = asprintf(&id, "+%s:%s", subsystem, sysname);
if (r < 0)
return -ENOMEM;
@@
-1262,7
+1270,7
@@
int device_read_db_aux(sd_device *device, bool force) {
}
/* devices with a database entry are initialized */
}
/* devices with a database entry are initialized */
- device->is_initialized = true;
;
+ device->is_initialized = true;
for (i = 0; i < db_len; i++) {
switch (state) {
for (i = 0; i < db_len; i++) {
switch (state) {