summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-device/sd-device.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-20 23:34:12 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-20 23:44:46 -0400
commit53fae771bcf1623cd28791c48fa60d9d5e5086e4 (patch)
tree0b87572f171a502eca76c97c73334861f27b08ab /src/libsystemd/sd-device/sd-device.c
parent925fbb9f80a8263216ee9f2fe9ab5c8d02651bb7 (diff)
sd-device: fix return codes on error
asprintf() does not set errno.
Diffstat (limited to 'src/libsystemd/sd-device/sd-device.c')
-rw-r--r--src/libsystemd/sd-device/sd-device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index 691b9c6327..97da4a8eea 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -1193,12 +1193,12 @@ int device_get_id_filename(sd_device *device, const char **ret) {
streq(subsystem, "block") ? 'b' : 'c',
major(devnum), minor(devnum));
if (r < 0)
- return -errno;
+ return -ENOMEM;
} else if (ifindex > 0) {
/* use netdev ifindex -- n3 */
r = asprintf(&id, "n%u", ifindex);
if (r < 0)
- return -errno;
+ return -ENOMEM;
} else {
/* use $subsys:$sysname -- pci:0000:00:1f.2
* sysname() has '!' translated, get it from devpath
@@ -1211,7 +1211,7 @@ int device_get_id_filename(sd_device *device, const char **ret) {
r = asprintf(&id, "+%s:%s", subsystem, sysname);
if (r < 0)
- return -errno;
+ return -ENOMEM;
}
device->id_filename = id;