diff options
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/dev-setup.c | 18 | ||||
-rw-r--r-- | src/udev/dev-setup.h | 2 |
2 files changed, 10 insertions, 10 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; } diff --git a/src/udev/dev-setup.h b/src/udev/dev-setup.h index 320c0b30ba..d41b6eefba 100644 --- a/src/udev/dev-setup.h +++ b/src/udev/dev-setup.h @@ -21,4 +21,4 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -void dev_setup(const char *pathprefix); +int dev_setup(const char *pathprefix); |