From cb623490542d762bc8766750b05ae719d9ca4eba Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 26 Jan 2022 19:37:12 +0100 Subject: [PATCH] plugins/bootmisc: only ignore EEXIST errors in ln() This patch prevents bogus error messages from Finit for when directories or symlinks already exist. Signed-off-by: Joachim Wiberg --- plugins/bootmisc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/bootmisc.c b/plugins/bootmisc.c index 54616850..93ccb87d 100644 --- a/plugins/bootmisc.c +++ b/plugins/bootmisc.c @@ -104,9 +104,9 @@ static void clean(void *arg) } } -static void ln(const char *target, const char *linkpath, int ignerr) +static void ln(const char *target, const char *linkpath) { - if (symlink(target, linkpath) && !ignerr) + if (symlink(target, linkpath) && errno != EEXIST) _pe("Failed creating %s -> %s symlink", target, linkpath); } @@ -131,11 +131,11 @@ static void setup(void *arg) _d("System with new /run tmpfs ..."); if (!fisdir("/run/lock")) makedir("/run/lock", 1777); - ln("/run/lock", "/var/lock", 0); - ln("/dev/shm", "/run/shm", 0); + ln("/run/lock", "/var/lock"); + ln("/dev/shm", "/run/shm"); /* compat only, should really be set up by OS/dist */ - ln("/run", "/var/run", 1); + ln("/run", "/var/run"); } else { makedir("/var/lock", 1777); makedir("/var/run", 0755); @@ -189,7 +189,7 @@ static void setup(void *arg) makedir("/var/run/sshd", 01755); /* OpenSSH */ if (!fexist("/etc/mtab")) - ln("../proc/self/mounts", "/etc/mtab", 1); + ln("../proc/self/mounts", "/etc/mtab"); /* Void Linux has a uuidd that runs as uuid:uuid and needs /run/uuid */ mksubsys("/var/run/uuidd", 0755, "uuidd", "uuidd");