aboutsummaryrefslogtreecommitdiff
path: root/src/librc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/librc.c')
-rw-r--r--src/librc.c11
1 files changed, 8 insertions, 3 deletions
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);
}