From 6baff6cd1d1c39c9abe02263c582512743907aa5 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 4 Mar 2008 10:36:20 +0000 Subject: Don't store empty services. --- src/librc/librc-depend.c | 9 +++++---- 1 file 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 { -- cgit v1.2.3