summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-12-11 09:57:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-12-11 09:57:39 +0000
commit490e677058ee4443379f6b43d346c2aba02b09da (patch)
treef8eedbaf8b1f968e18595bd7bb2fd6dde57c9e7c /src
parentbba745f906d2a29ec0f619f61c746ad8cbdf5621 (diff)
downloads6-490e677058ee4443379f6b43d346c2aba02b09da.tar.xz
Only realpath() if a given servicedir is not absolute
Diffstat (limited to 'src')
-rw-r--r--src/libs6/s6_supervise_link.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c
index 491a2aa..ff4bb1f 100644
--- a/src/libs6/s6_supervise_link.c
+++ b/src/libs6/s6_supervise_link.c
@@ -118,11 +118,18 @@ int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t
p = basename(fn) ;
len = strlen(p) ;
memcpy(lname + scdirlen + 1 + prefixlen, p, len + 1) ;
- rpsa.len = 0 ;
lstart = lnames.len ;
- if (sarealpath(&rpsa, servicedirs[i]) < 0 || !stralloc_0(&rpsa)) goto err ;
if (!stralloc_catb(&lnames, p, len + 1)) goto err ;
- if (symlink(rpsa.s, lname) < 0) goto errl ;
+ if (servicedirs[i][0] == '/')
+ {
+ if (symlink(servicedirs[i], lname) < 0) goto errl ;
+ }
+ else
+ {
+ rpsa.len = 0 ;
+ if (sarealpath(&rpsa, servicedirs[i]) < 0 || !stralloc_0(&rpsa)) goto errl ;
+ if (symlink(rpsa.s, lname) < 0) goto errl ;
+ }
}
stralloc_free(&rpsa) ;
r = s6_svc_writectl(scdir, S6_SVSCAN_CTLDIR, "a", 1) ;