aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-19 12:46:08 +0000
committerRoy Marples <roy@marples.name>2007-12-19 12:46:08 +0000
commitcd45e5435762d8c6cd13287df7df16b97755176e (patch)
treeef0c7fb0a96e103e2a0dd79ee8c0f47f62ae7174 /src/runscript.c
parent2f7218c9849e667ba20d76e4dfe46b4bb195063a (diff)
Introduce cbasename so we don't have to strdup(basename) and free all the time.
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/runscript.c b/src/runscript.c
index c52b33ea..6839497e 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -29,8 +29,6 @@
* SUCH DAMAGE.
*/
-#define APPLET "runscript"
-
#include <sys/select.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -40,7 +38,6 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
-#include <libgen.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
@@ -76,7 +73,7 @@
#define ONE_SECOND 1000000000
-static char *applet = NULL;
+static const char *applet = NULL;
static char *service = NULL;
static char *exclusive = NULL;
static char *mtime_test = NULL;
@@ -353,7 +350,6 @@ static void cleanup (void)
}
free (exclusive);
free (service);
- free (applet);
free (prefix);
free (softlevel);
}
@@ -502,7 +498,6 @@ static bool svc_exec (const char *arg1, const char *arg2)
static bool svc_wait (rc_depinfo_t *depinfo, const char *svc)
{
char *s;
- char *base;
char *fifo;
struct timespec ts;
int nloops = WAIT_MAX * (ONE_SECOND / WAIT_INTERVAL);
@@ -524,11 +519,7 @@ static bool svc_wait (rc_depinfo_t *depinfo, const char *svc)
}
rc_strlist_free (keywords);
- s = xstrdup (svc);
- base = basename (s);
- fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
- free (s);
-
+ fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", cbasename (svc), (char *) NULL);
ts.tv_sec = 0;
ts.tv_nsec = WAIT_INTERVAL;
@@ -1055,7 +1046,7 @@ int runscript (int argc, char **argv)
exit (EXIT_FAILURE);
}
- applet = xstrdup (basename (argv[1]));
+ applet = cbasename (argv[1]);
if (argc < 3)
usage (EXIT_FAILURE);