punt rc_is_link

This commit is contained in:
Roy Marples 2007-10-04 16:21:53 +00:00
parent bb9ad38de2
commit d65c484f3a
5 changed files with 4 additions and 25 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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)

View File

@ -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 */

View File

@ -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;