chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2a7e74e
)
udev: link-config - use safe_atou instead of strtoul
author
Tom Gundersen
<teg@jklm.no>
Tue, 29 Oct 2013 15:20:22 +0000
(16:20 +0100)
committer
Tom Gundersen
<teg@jklm.no>
Tue, 29 Oct 2013 15:21:57 +0000
(16:21 +0100)
src/udev/net/link-config.c
patch
|
blob
|
history
diff --git
a/src/udev/net/link-config.c
b/src/udev/net/link-config.c
index 985fc7d47a485765c983961894283ae5894b305c..a86c74d5f7ebcab88b86698b1baa1be1e8c747a5 100644
(file)
--- a/
src/udev/net/link-config.c
+++ b/
src/udev/net/link-config.c
@@
-322,12
+322,15
@@
static bool enable_name_policy(void) {
static bool mac_is_random(struct udev_device *device) {
const char *s;
static bool mac_is_random(struct udev_device *device) {
const char *s;
- int type;
+ unsigned type;
+ int r;
s = udev_device_get_sysattr_value(device, "addr_assign_type");
if (!s)
s = udev_device_get_sysattr_value(device, "addr_assign_type");
if (!s)
- return -EINVAL;
- type = strtoul(s, NULL, 0);
+ return false; /* if we don't know, assume it is not random */
+ r = safe_atou(s, &type);
+ if (r < 0)
+ return false;
/* check for NET_ADDR_RANDOM */
return type == 1;
/* check for NET_ADDR_RANDOM */
return type == 1;
@@
-335,12
+338,15
@@
static bool mac_is_random(struct udev_device *device) {
static bool mac_is_permanent(struct udev_device *device) {
const char *s;
static bool mac_is_permanent(struct udev_device *device) {
const char *s;
- int type;
+ unsigned type;
+ int r;
s = udev_device_get_sysattr_value(device, "addr_assign_type");
if (!s)
s = udev_device_get_sysattr_value(device, "addr_assign_type");
if (!s)
- return -EINVAL;
- type = strtoul(s, NULL, 0);
+ return true; /* if we don't know, assume it is permanent */
+ r = safe_atou(s, &type);
+ if (r < 0)
+ return true;
/* check for NET_ADDR_PERM */
return type == 0;
/* check for NET_ADDR_PERM */
return type == 0;