aboutsummaryrefslogtreecommitdiff
path: root/src/librc
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-04 10:36:20 +0000
committerRoy Marples <roy@marples.name>2008-03-04 10:36:20 +0000
commit6baff6cd1d1c39c9abe02263c582512743907aa5 (patch)
tree2594f2e91da283d8f4d6ed22bfbc40a8f2b85c6b /src/librc
parent6caea225d8d04c813055020c94e0d7ddd6eb7522 (diff)
Don't store empty services.
Diffstat (limited to 'src/librc')
-rw-r--r--src/librc/librc-depend.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 1718e22d..22470368 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -743,7 +743,7 @@ bool rc_deptree_update (void)
char **config = NULL;
int retval = true;
FILE *fp;
- rc_depinfo_t *deptree;
+ rc_depinfo_t *deptree = NULL;
rc_depinfo_t *depinfo;
rc_depinfo_t *di;
rc_depinfo_t *last_depinfo = NULL;
@@ -768,12 +768,11 @@ bool rc_deptree_update (void)
if (! (fp = popen (GENDEP, "r")))
return (false);
- deptree = xzalloc (sizeof (*deptree));
while ((line = rc_getline (fp)))
{
depends = line;
service = strsep (&depends, " ");
- if (! service)
+ if (! service || ! *service)
goto next;
type = strsep (&depends, " ");
@@ -786,7 +785,9 @@ bool rc_deptree_update (void)
if (! depinfo)
{
- if (! last_depinfo->service)
+ if (! last_depinfo)
+ deptree = depinfo = xzalloc (sizeof (*depinfo));
+ else if (! last_depinfo->service)
depinfo = last_depinfo;
else
{