aboutsummaryrefslogtreecommitdiff
path: root/src/rc-depend.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
committerRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
commit20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch)
treeb195111871b8e05c584b71aed066c3990c5db2b3 /src/rc-depend.c
parente3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff)
malloc over fatty buffers
Diffstat (limited to 'src/rc-depend.c')
-rw-r--r--src/rc-depend.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rc-depend.c b/src/rc-depend.c
index 2e0d3037..8a0f1894 100644
--- a/src/rc-depend.c
+++ b/src/rc-depend.c
@@ -40,7 +40,7 @@ static char *applet = NULL;
#include "_usage.h"
#define getoptstring "t:suT" getoptstring_COMMON
static struct option longopts[] = {
- { "type", 0, NULL, 't'},
+ { "type", 1, NULL, 't'},
{ "notrace", 0, NULL, 'T'},
{ "strict", 0, NULL, 's'},
{ "update", 0, NULL, 'u'},
@@ -67,7 +67,7 @@ int rc_depend (int argc, char **argv)
bool first = true;
int i;
bool update = false;
- char *runlevel = getenv ("RC_SOFTLEVEL");
+ char *runlevel = xstrdup( getenv ("RC_SOFTLEVEL"));
int opt;
char *token;
@@ -104,12 +104,12 @@ int rc_depend (int argc, char **argv)
eerrorx ("Failed to update the dependency tree");
}
- if (! runlevel)
- runlevel = rc_runlevel_get ();
-
if (! (deptree = _rc_deptree_load ()))
eerrorx ("failed to load deptree");
+ if (! runlevel)
+ runlevel = rc_runlevel_get ();
+
while (optind < argc) {
list = NULL;
rc_strlist_add (&list, argv[optind]);
@@ -128,6 +128,7 @@ int rc_depend (int argc, char **argv)
if (! services) {
rc_strlist_free (types);
rc_deptree_free (deptree);
+ free (runlevel);
if (update)
return (EXIT_SUCCESS);
eerrorx ("no services specified");
@@ -159,5 +160,6 @@ int rc_depend (int argc, char **argv)
rc_strlist_free (services);
rc_strlist_free (depends);
rc_deptree_free (deptree);
+ free (runlevel);
return (EXIT_SUCCESS);
}