We should check we resolved a service before stating it's existance.

This commit is contained in:
Roy Marples 2008-01-06 21:06:47 +00:00
parent b1540cba5b
commit 16a2c82bd1
2 changed files with 4 additions and 1 deletions

View File

@ -283,6 +283,7 @@ static char **get_provided (const rc_depinfo_t *deptree,
if (! deptree || ! depinfo) if (! deptree || ! depinfo)
return (NULL); return (NULL);
if (rc_service_exists (depinfo->service)) if (rc_service_exists (depinfo->service))
return (NULL); return (NULL);

View File

@ -289,7 +289,9 @@ bool rc_service_exists (const char *service)
service[len - 1] == 'h') service[len - 1] == 'h')
return (false); return (false);
file = rc_service_resolve (service); if (! (file = rc_service_resolve (service)))
return (false);
if (stat (file, &buf) == 0 && buf.st_mode & S_IXUGO) if (stat (file, &buf) == 0 && buf.st_mode & S_IXUGO)
retval = true; retval = true;
free (file); free (file);