diff options
author | Roy Marples <roy@marples.name> | 2007-10-04 16:21:53 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-10-04 16:21:53 +0000 |
commit | d65c484f3a1b210048045613c524c29fdfcb470c (patch) | |
tree | 5363e0d68a597eb38f1fd71b57b6ec0fa2c5a4e9 | |
parent | bb9ad38de2dab93c5cdb0745b055c3346b6684c9 (diff) |
punt rc_is_link
-rw-r--r-- | src/librc-misc.c | 15 | ||||
-rw-r--r-- | src/librc.c | 7 | ||||
-rw-r--r-- | src/librc.h | 1 | ||||
-rw-r--r-- | src/rc.h | 5 | ||||
-rw-r--r-- | src/rc.map | 1 |
5 files changed, 4 insertions, 25 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c index a8709903..060bee09 100644 --- a/src/librc-misc.c +++ b/src/librc-misc.c @@ -166,21 +166,6 @@ bool rc_is_dir (const char *pathname) } librc_hidden_def(rc_is_dir) -bool rc_is_link (const char *pathname) -{ - struct stat buf; - - if (! pathname) - return (false); - - if (lstat (pathname, &buf) == 0) - return (S_ISLNK (buf.st_mode)); - - errno = 0; - return (false); -} -librc_hidden_def(rc_is_link) - bool rc_is_exec (const char *pathname) { struct stat buf; diff --git a/src/librc.c b/src/librc.c index 2c0cdcdf..dcbc9872 100644 --- a/src/librc.c +++ b/src/librc.c @@ -131,12 +131,13 @@ bool rc_runlevel_exists (const char *runlevel) } librc_hidden_def(rc_runlevel_exists) - /* Resolve a service name to it's full path */ +/* Resolve a service name to it's full path */ char *rc_service_resolve (const char *service) { char buffer[PATH_MAX]; char *file; int r = 0; + struct stat buf; if (! service) return (NULL); @@ -145,10 +146,10 @@ char *rc_service_resolve (const char *service) return (rc_xstrdup (service)); file = rc_strcatpaths (RC_SVCDIR, "started", service, (char *) NULL); - if (! rc_is_link (file)) { + if (lstat (file, &buf) || ! S_ISLNK (buf.st_mode)) { free (file); file = rc_strcatpaths (RC_SVCDIR, "inactive", service, (char *) NULL); - if (! rc_is_link (file)) { + if (lstat (file, &buf) || ! S_ISLNK (buf.st_mode)) { free (file); file = NULL; } diff --git a/src/librc.h b/src/librc.h index 469b6740..1506f39a 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_link) librc_hidden_proto(rc_ls_dir) librc_hidden_proto(rc_rm_dir) librc_hidden_proto(rc_runlevel_exists) @@ -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 symbolic link or not - * @param pathname to check - * @return true if it's a symbolic link, otherwise false */ -bool rc_is_link (const char *pathname); - /*! Check if the file is a directory or not * @param pathname to check * @return true if it's a directory, otherwise false */ @@ -17,7 +17,6 @@ global: rc_find_pids; rc_is_dir; rc_is_exec; - rc_is_link; rc_ls_dir; rc_rm_dir; rc_runlevel_exists; |