summaryrefslogtreecommitdiff
path: root/src/udev/dev-setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/dev-setup.c')
-rw-r--r--src/udev/dev-setup.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/udev/dev-setup.c b/src/udev/dev-setup.c
index 50a187fda9..1a565d5470 100644
--- a/src/udev/dev-setup.c
+++ b/src/udev/dev-setup.c
@@ -50,7 +50,7 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
return r;
}
-void dev_setup(const char *prefix) {
+int dev_setup(const char *prefix) {
const char *j, *k;
static const char symlinks[] =
@@ -64,21 +64,21 @@ void dev_setup(const char *prefix) {
if (j[0] == '-') {
j++;
- if (access(j, F_OK))
+ if (access(j, F_OK) < 0)
continue;
}
if (prefix) {
- char *linkname;
+ _cleanup_free_ char *link_name = NULL;
- if (asprintf(&linkname, "%s/%s", prefix, k) < 0) {
- log_oom();
- break;
- }
+ link_name = strjoin(prefix, "/", k, NULL);
+ if (!link_name)
+ return -ENOMEM;
- symlink_and_label(j, linkname);
- free(linkname);
+ symlink_and_label(j, link_name);
} else
symlink_and_label(j, k);
}
+
+ return 0;
}