punt rc_is_exec
This commit is contained in:
parent
d65c484f3a
commit
e2e40afdde
@ -15,10 +15,6 @@
|
||||
|
||||
#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
|
||||
#ifndef S_IXUGO
|
||||
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
#endif
|
||||
|
||||
void *rc_xmalloc (size_t size)
|
||||
{
|
||||
void *value = malloc (size);
|
||||
@ -166,21 +162,6 @@ bool rc_is_dir (const char *pathname)
|
||||
}
|
||||
librc_hidden_def(rc_is_dir)
|
||||
|
||||
bool rc_is_exec (const char *pathname)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (! pathname)
|
||||
return (false);
|
||||
|
||||
if (lstat (pathname, &buf) == 0)
|
||||
return (buf.st_mode & S_IXUGO);
|
||||
|
||||
errno = 0;
|
||||
return (false);
|
||||
}
|
||||
librc_hidden_def(rc_is_exec)
|
||||
|
||||
char **rc_ls_dir (const char *dir, int options)
|
||||
{
|
||||
DIR *dp;
|
||||
|
11
src/librc.c
11
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);
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ librc_hidden_proto(rc_env_filter)
|
||||
librc_hidden_proto(rc_exists)
|
||||
librc_hidden_proto(rc_find_pids)
|
||||
librc_hidden_proto(rc_is_dir)
|
||||
librc_hidden_proto(rc_is_exec)
|
||||
librc_hidden_proto(rc_ls_dir)
|
||||
librc_hidden_proto(rc_rm_dir)
|
||||
librc_hidden_proto(rc_runlevel_exists)
|
||||
|
5
src/rc.h
5
src/rc.h
@ -468,11 +468,6 @@ bool rc_exists (const char *pathname);
|
||||
* @return true if it's a directory, otherwise false */
|
||||
bool rc_is_dir (const char *pathname);
|
||||
|
||||
/*! Check if the file is marked executable or not
|
||||
* @param pathname to check
|
||||
* @return true if it's marked executable, otherwise false */
|
||||
bool rc_is_exec (const char *pathname);
|
||||
|
||||
/*! @name rc_ls_dir options */
|
||||
/*! Ensure that an init.d service exists for each file returned */
|
||||
#define RC_LS_INITD 0x01
|
||||
|
@ -16,7 +16,6 @@ global:
|
||||
rc_exists;
|
||||
rc_find_pids;
|
||||
rc_is_dir;
|
||||
rc_is_exec;
|
||||
rc_ls_dir;
|
||||
rc_rm_dir;
|
||||
rc_runlevel_exists;
|
||||
|
Loading…
Reference in New Issue
Block a user