Rename find_binary to find_executable
"executable" is more correct than "binary", since scripts are OK too.
This commit is contained in:
+7
-13
@@ -593,7 +593,7 @@ char* path_join_internal(const char *first, ...) {
|
||||
return joined;
|
||||
}
|
||||
|
||||
int find_binary(const char *name, char **ret) {
|
||||
int find_executable(const char *name, char **ret) {
|
||||
int last_error, r;
|
||||
const char *p;
|
||||
|
||||
@@ -612,10 +612,7 @@ int find_binary(const char *name, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plain getenv, not secure_getenv, because we want
|
||||
* to actually allow the user to pick the binary.
|
||||
*/
|
||||
/* Plain getenv, not secure_getenv, because we want to actually allow the user to pick the binary. */
|
||||
p = getenv("PATH");
|
||||
if (!p)
|
||||
p = DEFAULT_PATH;
|
||||
@@ -649,9 +646,7 @@ int find_binary(const char *name, char **ret) {
|
||||
if (access(with_dash, X_OK) >= 0)
|
||||
continue;
|
||||
|
||||
/**
|
||||
* We can't just `continue` inverting this case, since we need to update last_error.
|
||||
*/
|
||||
/* We can't just `continue` inverting this case, since we need to update last_error. */
|
||||
if (errno == ENOTDIR) {
|
||||
/* Found it! */
|
||||
if (ret)
|
||||
@@ -704,18 +699,17 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd
|
||||
return changed;
|
||||
}
|
||||
|
||||
static int binary_is_good(const char *binary) {
|
||||
static int executable_is_good(const char *executable) {
|
||||
_cleanup_free_ char *p = NULL, *d = NULL;
|
||||
int r;
|
||||
|
||||
r = find_binary(binary, &p);
|
||||
r = find_executable(executable, &p);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* An fsck that is linked to /bin/true is a non-existent
|
||||
* fsck */
|
||||
/* An fsck that is linked to /bin/true is a non-existent fsck */
|
||||
|
||||
r = readlink_malloc(p, &d);
|
||||
if (r == -EINVAL) /* not a symlink */
|
||||
@@ -738,7 +732,7 @@ int fsck_exists(const char *fstype) {
|
||||
return -EINVAL;
|
||||
|
||||
checker = strjoina("fsck.", fstype);
|
||||
return binary_is_good(checker);
|
||||
return executable_is_good(checker);
|
||||
}
|
||||
|
||||
int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg) {
|
||||
|
||||
@@ -80,7 +80,7 @@ int path_strv_make_absolute_cwd(char **l);
|
||||
char** path_strv_resolve(char **l, const char *root);
|
||||
char** path_strv_resolve_uniq(char **l, const char *root);
|
||||
|
||||
int find_binary(const char *name, char **filename);
|
||||
int find_executable(const char *name, char **filename);
|
||||
|
||||
bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user