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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-01-27 18:45:00 +01:00
1 parent 1b72119673
commit cb62349054
1 file changed
+6 -6
+6 -6
View File
@@ -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); _pe("Failed creating %s -> %s symlink", target, linkpath);
} }
@@ -131,11 +131,11 @@ static void setup(void *arg)
_d("System with new /run tmpfs ..."); _d("System with new /run tmpfs ...");
if (!fisdir("/run/lock")) if (!fisdir("/run/lock"))
makedir("/run/lock", 1777); makedir("/run/lock", 1777);
ln("/run/lock", "/var/lock", 0); ln("/run/lock", "/var/lock");
ln("/dev/shm", "/run/shm", 0); ln("/dev/shm", "/run/shm");
/* compat only, should really be set up by OS/dist */ /* compat only, should really be set up by OS/dist */
ln("/run", "/var/run", 1); ln("/run", "/var/run");
} else { } else {
makedir("/var/lock", 1777); makedir("/var/lock", 1777);
makedir("/var/run", 0755); makedir("/var/run", 0755);
@@ -189,7 +189,7 @@ static void setup(void *arg)
makedir("/var/run/sshd", 01755); /* OpenSSH */ makedir("/var/run/sshd", 01755); /* OpenSSH */
if (!fexist("/etc/mtab")) 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 */ /* Void Linux has a uuidd that runs as uuid:uuid and needs /run/uuid */
mksubsys("/var/run/uuidd", 0755, "uuidd", "uuidd"); mksubsys("/var/run/uuidd", 0755, "uuidd", "uuidd");