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"
|
#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 *rc_xmalloc (size_t size)
|
||||||
{
|
{
|
||||||
void *value = malloc (size);
|
void *value = malloc (size);
|
||||||
@ -166,21 +162,6 @@ bool rc_is_dir (const char *pathname)
|
|||||||
}
|
}
|
||||||
librc_hidden_def(rc_is_dir)
|
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)
|
char **rc_ls_dir (const char *dir, int options)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
#define SOFTLEVEL RC_SVCDIR "/softlevel"
|
#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 stream used for plugins to write environ vars to */
|
||||||
FILE *rc_environ_fd = NULL;
|
FILE *rc_environ_fd = NULL;
|
||||||
|
|
||||||
@ -173,6 +177,7 @@ bool rc_service_exists (const char *service)
|
|||||||
char *file;
|
char *file;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
int len;
|
int len;
|
||||||
|
struct stat buf;
|
||||||
|
|
||||||
if (! service)
|
if (! service)
|
||||||
return (false);
|
return (false);
|
||||||
@ -186,8 +191,8 @@ bool rc_service_exists (const char *service)
|
|||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
file = rc_service_resolve (service);
|
file = rc_service_resolve (service);
|
||||||
if (rc_exists (file))
|
if (stat (file, &buf) == 0 && buf.st_mode & S_IXUGO)
|
||||||
retval = rc_is_exec (file);
|
retval = true;
|
||||||
free (file);
|
free (file);
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ librc_hidden_proto(rc_env_filter)
|
|||||||
librc_hidden_proto(rc_exists)
|
librc_hidden_proto(rc_exists)
|
||||||
librc_hidden_proto(rc_find_pids)
|
librc_hidden_proto(rc_find_pids)
|
||||||
librc_hidden_proto(rc_is_dir)
|
librc_hidden_proto(rc_is_dir)
|
||||||
librc_hidden_proto(rc_is_exec)
|
|
||||||
librc_hidden_proto(rc_ls_dir)
|
librc_hidden_proto(rc_ls_dir)
|
||||||
librc_hidden_proto(rc_rm_dir)
|
librc_hidden_proto(rc_rm_dir)
|
||||||
librc_hidden_proto(rc_runlevel_exists)
|
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 */
|
* @return true if it's a directory, otherwise false */
|
||||||
bool rc_is_dir (const char *pathname);
|
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 */
|
/*! @name rc_ls_dir options */
|
||||||
/*! Ensure that an init.d service exists for each file returned */
|
/*! Ensure that an init.d service exists for each file returned */
|
||||||
#define RC_LS_INITD 0x01
|
#define RC_LS_INITD 0x01
|
||||||
|
@ -16,7 +16,6 @@ global:
|
|||||||
rc_exists;
|
rc_exists;
|
||||||
rc_find_pids;
|
rc_find_pids;
|
||||||
rc_is_dir;
|
rc_is_dir;
|
||||||
rc_is_exec;
|
|
||||||
rc_ls_dir;
|
rc_ls_dir;
|
||||||
rc_rm_dir;
|
rc_rm_dir;
|
||||||
rc_runlevel_exists;
|
rc_runlevel_exists;
|
||||||
|
Loading…
Reference in New Issue
Block a user