From 16a2c82bd194a41cab45021799b4251cf926a051 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sun, 6 Jan 2008 21:06:47 +0000 Subject: [PATCH] We should check we resolved a service before stating it's existance. --- src/librc/librc-depend.c | 1 + src/librc/librc.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index 902d012f..0ce95e60 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -283,6 +283,7 @@ static char **get_provided (const rc_depinfo_t *deptree, if (! deptree || ! depinfo) return (NULL); + if (rc_service_exists (depinfo->service)) return (NULL); diff --git a/src/librc/librc.c b/src/librc/librc.c index 15309f87..dbabdc03 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -289,7 +289,9 @@ bool rc_service_exists (const char *service) service[len - 1] == 'h') 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) retval = true; free (file);