From e2e40afddef5253d5d669002b9afbea6bf3d6c66 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 4 Oct 2007 16:26:44 +0000 Subject: punt rc_is_exec --- src/librc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/librc.c') diff --git a/src/librc.c b/src/librc.c index dcbc9872..58f450da 100644 --- a/src/librc.c +++ b/src/librc.c @@ -15,6 +15,10 @@ #define SOFTLEVEL RC_SVCDIR "/softlevel" +#ifndef S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + /* File stream used for plugins to write environ vars to */ FILE *rc_environ_fd = NULL; @@ -173,6 +177,7 @@ bool rc_service_exists (const char *service) char *file; bool retval = false; int len; + struct stat buf; if (! service) return (false); @@ -185,9 +190,9 @@ bool rc_service_exists (const char *service) service[len - 1] == 'h') return (false); - file = rc_service_resolve (service); - if (rc_exists (file)) - retval = rc_is_exec (file); + file = rc_service_resolve (service); + if (stat (file, &buf) == 0 && buf.st_mode & S_IXUGO) + retval = true; free (file); return (retval); } -- cgit v1.2.3