aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-04 17:00:56 +0000
committerRoy Marples <roy@marples.name>2007-10-04 17:00:56 +0000
commit15fde9a796a45999b2fdebebbe8862f33cf4965b (patch)
treec5ecbd4750bf65a6c309ab64bc4561b2c86aadfb
parent87ea3e9e3bfa8e96b31d682f29fc7959bdd1b39e (diff)
Punt rc_exists from public interface, move to private static inline
-rw-r--r--src/librc-misc.c15
-rw-r--r--src/rc-misc.h15
-rw-r--r--src/rc.h5
-rw-r--r--src/rc.map1
4 files changed, 15 insertions, 21 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c
index 4cc69be0..193b77c0 100644
--- a/src/librc-misc.c
+++ b/src/librc-misc.c
@@ -132,21 +132,6 @@ char *rc_strcatpaths (const char *path1, const char *paths, ...)
}
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)
{
DIR *dp;
diff --git a/src/rc-misc.h b/src/rc-misc.h
index bfe54d15..40228b70 100644
--- a/src/rc-misc.h
+++ b/src/rc-misc.h
@@ -7,6 +7,9 @@
#ifndef __RC_MISC_H__
#define __RC_MISC_H__
+#include <sys/stat.h>
+#include <errno.h>
+
#ifndef LIB
# define LIB "lib"
#endif
@@ -38,4 +41,16 @@
/* 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"
+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
diff --git a/src/rc.h b/src/rc.h
index 5d5ded67..7be9849b 100644
--- a/src/rc.h
+++ b/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. */
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 */
/*! Ensure that an init.d service exists for each file returned */
#define RC_LS_INITD 0x01
diff --git a/src/rc.map b/src/rc.map
index b6ef0a54..6fb6220b 100644
--- a/src/rc.map
+++ b/src/rc.map
@@ -13,7 +13,6 @@ global:
rc_env_config;
rc_env_filter;
rc_environ_fd;
- rc_exists;
rc_find_pids;
rc_ls_dir;
rc_rm_dir;