Use realpath to resolve our service.
This commit is contained in:
parent
75f5b5fe1d
commit
d3b7a91796
@ -69,7 +69,7 @@
|
|||||||
#define PREFIX_LOCK RC_SVCDIR "/prefix.lock"
|
#define PREFIX_LOCK RC_SVCDIR "/prefix.lock"
|
||||||
|
|
||||||
static char *applet = NULL;
|
static char *applet = NULL;
|
||||||
static char *service = NULL;
|
static char service[PATH_MAX];
|
||||||
static char *exclusive = NULL;
|
static char *exclusive = NULL;
|
||||||
static char *mtime_test = NULL;
|
static char *mtime_test = NULL;
|
||||||
static rc_depinfo_t *deptree = NULL;
|
static rc_depinfo_t *deptree = NULL;
|
||||||
@ -347,7 +347,6 @@ static void cleanup (void)
|
|||||||
free (exclusive);
|
free (exclusive);
|
||||||
free (applet);
|
free (applet);
|
||||||
free (prefix);
|
free (prefix);
|
||||||
free (service);
|
|
||||||
free (softlevel);
|
free (softlevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,14 +991,9 @@ int runscript (int argc, char **argv)
|
|||||||
char *svc;
|
char *svc;
|
||||||
|
|
||||||
/* We need the full path to the service */
|
/* We need the full path to the service */
|
||||||
if (*argv[1] == '/')
|
if (! realpath (argv[0], service))
|
||||||
service = xstrdup (argv[1]);
|
eerrorx ("unable to resolve the path `%s': %s",
|
||||||
else {
|
argv[0], strerror (errno));
|
||||||
char pwd[PATH_MAX];
|
|
||||||
if (! getcwd (pwd, PATH_MAX))
|
|
||||||
eerrorx ("getcwd: %s", strerror (errno));
|
|
||||||
service = rc_strcatpaths (pwd, argv[1], (char *) NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
applet = xstrdup (basename (service));
|
applet = xstrdup (basename (service));
|
||||||
atexit (cleanup);
|
atexit (cleanup);
|
||||||
|
Loading…
Reference in New Issue
Block a user