diff options
author | Daniel Mack <github@zonque.org> | 2015-11-03 07:15:44 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-11-03 07:15:44 +0100 |
commit | a31afe1a18cca840046d976a637c7918ec6f5fe2 (patch) | |
tree | 11fd3c0d57bcae37069117036904fe3a8c7f7209 /src/libsystemd | |
parent | 3342582deb95b6e364541435654eb8f6fa320f40 (diff) | |
parent | 2c1a55cf3fe78bcf728f73487813ddd3ee020a98 (diff) |
Merge pull request #1758 from poettering/varietygalore
A grab bag of stuff
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-device/sd-device.c | 9 | ||||
-rw-r--r-- | src/libsystemd/sd-login/sd-login.c | 4 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 0d40bc5c00..0e49262087 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -356,13 +356,10 @@ int device_set_ifindex(sd_device *device, const char *_ifindex) { assert(device); assert(_ifindex); - r = safe_atoi(_ifindex, &ifindex); + r = parse_ifindex(_ifindex, &ifindex); if (r < 0) return r; - if (ifindex <= 0) - return -EINVAL; - r = device_add_property_internal(device, "IFINDEX", _ifindex); if (r < 0) return r; @@ -632,11 +629,9 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) { struct ifreq ifr = {}; int ifindex; - r = safe_atoi(&id[1], &ifr.ifr_ifindex); + r = parse_ifindex(&id[1], &ifr.ifr_ifindex); if (r < 0) return r; - else if (ifr.ifr_ifindex <= 0) - return -EINVAL; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index cd766c3f91..3f2e459825 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -932,9 +932,7 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ifindices) { *(char*) (mempcpy(buf, word, l)) = 0; - if (safe_atoi(buf, &ifi) < 0) - continue; - if (ifi <= 0) + if (parse_ifindex(buf, &ifi) < 0) continue; if (!GREEDY_REALLOC(ni, allocated, nr+1)) { |