diff options
author | Roy Marples <roy@marples.name> | 2007-10-04 16:16:06 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-10-04 16:16:06 +0000 |
commit | bb9ad38de2dab93c5cdb0745b055c3346b6684c9 (patch) | |
tree | b4b9d9492d6eacebce16542bd7d9a158d731e8bd /src | |
parent | bd83448633f7e3a2d9d37120090bf3e0460c059a (diff) |
Punt rc_is_file
Diffstat (limited to 'src')
-rw-r--r-- | src/librc-misc.c | 17 | ||||
-rw-r--r-- | src/librc.c | 4 | ||||
-rw-r--r-- | src/librc.h | 1 | ||||
-rw-r--r-- | src/rc.h | 7 | ||||
-rw-r--r-- | src/rc.map | 1 | ||||
-rw-r--r-- | src/start-stop-daemon.c | 4 |
6 files changed, 6 insertions, 28 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c index 1db360dc..a8709903 100644 --- a/src/librc-misc.c +++ b/src/librc-misc.c @@ -151,21 +151,6 @@ bool rc_exists (const char *pathname) } librc_hidden_def(rc_exists) -bool rc_is_file (const char *pathname) -{ - struct stat buf; - - if (! pathname) - return (false); - - if (stat (pathname, &buf) == 0) - return (S_ISREG (buf.st_mode)); - - errno = 0; - return (false); -} -librc_hidden_def(rc_is_file) - bool rc_is_dir (const char *pathname) { struct stat buf; @@ -447,7 +432,7 @@ char **rc_env_filter (void) if (! whitelist) return (NULL); - if (rc_is_file (PROFILE_ENV)) + if (rc_exists (PROFILE_ENV)) profile = rc_config_load (PROFILE_ENV); STRLIST_FOREACH (whitelist, env_name, count) { diff --git a/src/librc.c b/src/librc.c index c93c1ee9..2c0cdcdf 100644 --- a/src/librc.c +++ b/src/librc.c @@ -296,7 +296,7 @@ bool rc_service_mark (const char *service, const rc_service_state_t state) base = basename (svc); if (state != RC_SERVICE_STOPPED) { - if (! rc_is_file(init)) { + if (! rc_exists (init)) { free (init); free (svc); return (false); @@ -498,7 +498,7 @@ static pid_t _exec_service (const char *service, const char *arg) char *svc; file = rc_service_resolve (service); - if (! rc_is_file (file)) { + if (! rc_exists (file)) { rc_service_mark (service, RC_SERVICE_STOPPED); free (file); return (0); diff --git a/src/librc.h b/src/librc.h index efed97f2..469b6740 100644 --- a/src/librc.h +++ b/src/librc.h @@ -67,7 +67,6 @@ 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_is_file) librc_hidden_proto(rc_is_link) librc_hidden_proto(rc_ls_dir) librc_hidden_proto(rc_rm_dir) @@ -22,7 +22,7 @@ #include <sys/types.h> #include <stdbool.h> -#include <stdio.h> +//#include <stdio.h> /*! @name Reserved runlevel names */ #define RC_LEVEL_SYSINIT "sysinit" @@ -463,11 +463,6 @@ bool rc_env_bool (const char *variable); * @return true if it exists, otherwise false */ bool rc_exists (const char *pathname); -/*! Check if the file is a real file - * @param pathname to check - * @return true if it's a real file, otherwise false */ -bool rc_is_file (const char *pathname); - /*! Check if the file is a symbolic link or not * @param pathname to check * @return true if it's a symbolic link, otherwise false */ @@ -17,7 +17,6 @@ global: rc_find_pids; rc_is_dir; rc_is_exec; - rc_is_file; rc_is_link; rc_ls_dir; rc_rm_dir; diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c index 8fdcaa33..80bc86fe 100644 --- a/src/start-stop-daemon.c +++ b/src/start-stop-daemon.c @@ -728,7 +728,7 @@ int start_stop_daemon (int argc, char **argv) tmp = rc_strcatpaths (ch_root, exec, (char *) NULL); else tmp = exec; - if (! rc_is_file (tmp)) { + if (! rc_exists (tmp)) { eerror ("%s: %s does not exist", applet, tmp); if (ch_root) free (tmp); @@ -754,7 +754,7 @@ int start_stop_daemon (int argc, char **argv) if (result < 1) exit (result == 0 ? EXIT_SUCCESS : EXIT_FAILURE); - if (pidfile && rc_is_file (pidfile)) + if (pidfile && rc_exists (pidfile)) unlink (pidfile); if (svcname) |