Punt rc_exists from public interface, move to private static inline
This commit is contained in:
@ -132,21 +132,6 @@ char *rc_strcatpaths (const char *path1, const char *paths, ...)
|
|||||||
}
|
}
|
||||||
librc_hidden_def(rc_strcatpaths)
|
librc_hidden_def(rc_strcatpaths)
|
||||||
|
|
||||||
bool rc_exists (const char *pathname)
|
|
||||||
{
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
if (! pathname)
|
|
||||||
return (false);
|
|
||||||
|
|
||||||
if (stat (pathname, &buf) == 0)
|
|
||||||
return (true);
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
librc_hidden_def(rc_exists)
|
|
||||||
|
|
||||||
char **rc_ls_dir (const char *dir, int options)
|
char **rc_ls_dir (const char *dir, int options)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#ifndef __RC_MISC_H__
|
#ifndef __RC_MISC_H__
|
||||||
#define __RC_MISC_H__
|
#define __RC_MISC_H__
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifndef LIB
|
#ifndef LIB
|
||||||
# define LIB "lib"
|
# define LIB "lib"
|
||||||
#endif
|
#endif
|
||||||
@ -38,4 +41,16 @@
|
|||||||
/* Good defaults just incase user has none set */
|
/* Good defaults just incase user has none set */
|
||||||
#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
|
#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
|
||||||
|
|
||||||
|
static inline bool rc_exists (const char *pathname)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
int serrno = errno;
|
||||||
|
|
||||||
|
if (stat (pathname, &buf) == 0)
|
||||||
|
return (true);
|
||||||
|
|
||||||
|
errno = serrno;
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
5
src/rc.h
5
src/rc.h
@ -458,11 +458,6 @@ char *rc_strcatpaths (const char *path1, const char *paths, ...) SENTINEL;
|
|||||||
* @return true if it matches true, yes or 1, false if otherwise. */
|
* @return true if it matches true, yes or 1, false if otherwise. */
|
||||||
bool rc_env_bool (const char *variable);
|
bool rc_env_bool (const char *variable);
|
||||||
|
|
||||||
/*! Check if the file exists or not
|
|
||||||
* @param pathname to check
|
|
||||||
* @return true if it exists, otherwise false */
|
|
||||||
bool rc_exists (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
|
||||||
|
@ -13,7 +13,6 @@ global:
|
|||||||
rc_env_config;
|
rc_env_config;
|
||||||
rc_env_filter;
|
rc_env_filter;
|
||||||
rc_environ_fd;
|
rc_environ_fd;
|
||||||
rc_exists;
|
|
||||||
rc_find_pids;
|
rc_find_pids;
|
||||||
rc_ls_dir;
|
rc_ls_dir;
|
||||||
rc_rm_dir;
|
rc_rm_dir;
|
||||||
|
Reference in New Issue
Block a user