aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-19 14:54:35 +0000
committerRoy Marples <roy@marples.name>2007-04-19 14:54:35 +0000
commit2569e85579bc5c7d676865b386398119f04a5912 (patch)
tree41724e54856c9323b53428e49258f56f1102c0ed /src/runscript.c
parent3ed60d52026c484dce2d1856ea3bb893b8ee7d92 (diff)
strdup -> rc_xstrdup
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/runscript.c b/src/runscript.c
index 6f372270..4ebd7917 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -15,16 +15,13 @@
#include <dlfcn.h>
#include <errno.h>
#include <getopt.h>
+#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#ifndef __linux__
-#include <libgen.h>
-#endif
-
#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
@@ -802,7 +799,7 @@ static void svc_restart (const char *service, bool deps)
if (inactive) {
rc_schedule_start_service (service, svc);
ewarn ("WARNING: %s is scheduled to started when %s has started",
- svc, basename (service));
+ svc, applet);
} else
rc_start_service (svc);
}
@@ -821,11 +818,11 @@ static struct option longopts[] = {
{ "help", 0, NULL, 'h'},
{ NULL, 0, NULL, 0}
};
-#include "_usage.c"
+// #include "_usage.c"
int main (int argc, char **argv)
{
- const char *service = argv[1];
+ char *service = argv[1];
int i;
bool deps = true;
bool doneone = false;
@@ -840,7 +837,7 @@ int main (int argc, char **argv)
applet, strerror (errno));
}
- applet = strdup (basename (service));
+ applet = rc_xstrdup (basename (service));
atexit (cleanup);
#ifdef __linux__
@@ -956,7 +953,7 @@ int main (int argc, char **argv)
that is being called and not any dependents */
if (getenv ("IN_BACKGROUND")) {
in_background = rc_is_env ("IN_BACKGROUND", "true");
- ibsave = strdup (getenv ("IN_BACKGROUND"));
+ ibsave = rc_xstrdup (getenv ("IN_BACKGROUND"));
unsetenv ("IN_BACKGROUND");
}