diff options
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r-- | src/libudev/libudev-util.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c index 00dc6e157e..e626aad53e 100644 --- a/src/libudev/libudev-util.c +++ b/src/libudev/libudev-util.c @@ -96,7 +96,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, strscpy(result, maxsize, val); else result[0] = '\0'; - udev_dbg(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + log_debug("value '[%s/%s]%s' is '%s'", subsys, sysname, attr, result); } else { size_t l; char *s; @@ -105,7 +105,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, l = strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); if (attr != NULL) strpcpyl(&s, l, "/", attr, NULL); - udev_dbg(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + log_debug("path '[%s/%s]%s' is '%s'", subsys, sysname, attr, result); } udev_device_unref(dev); return 0; @@ -162,9 +162,13 @@ int util_log_priority(const char *priority) char *endptr; int prio; - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0' || isspace(endptr[0])) - return prio; + prio = strtoul(priority, &endptr, 10); + if (endptr[0] == '\0' || isspace(endptr[0])) { + if (prio >= 0 && prio <= 7) + return prio; + else + return -ERANGE; + } return log_level_from_string(priority); } |