summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2012-01-10 19:37:41 +0100
committerKay Sievers <kay.sievers@vrfy.org>2012-01-10 19:37:41 +0100
commitbd59d82322503b796ed6e80425df4bd24b5059ee (patch)
tree7cc7cd00848d50d73abb26978c48b828b97e24fc /src
parentdb8f32f6ed7cbf641311280585094e69110c4e6e (diff)
fix compiler warning
Diffstat (limited to 'src')
-rw-r--r--src/libudev-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libudev-util.c b/src/libudev-util.c
index a795329f7c..7e345f0fb6 100644
--- a/src/libudev-util.c
+++ b/src/libudev-util.c
@@ -56,7 +56,7 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
ssize_t len;
int i;
int back;
- char *base;
+ char *base = NULL;
len = readlink(syspath, link_target, sizeof(link_target));
if (len <= 0 || len == (ssize_t)sizeof(link_target))
@@ -70,9 +70,11 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
for (i = 0; i <= back; i++) {
base = strrchr(syspath, '/');
if (base == NULL)
- return -1;
+ return -EINVAL;
base[0] = '\0';
}
+ if (base == NULL)
+ return -EINVAL;
dbg(udev, "after moving back '%s'\n", syspath);
util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL);
return 0;