mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
chase-symlinks: Remove unused ret_fd arguments
This commit is contained in:
@@ -631,21 +631,19 @@ int chase_symlinks_and_stat(
|
||||
const char *root,
|
||||
ChaseSymlinksFlags chase_flags,
|
||||
char **ret_path,
|
||||
struct stat *ret_stat,
|
||||
int *ret_fd) {
|
||||
struct stat *ret_stat) {
|
||||
|
||||
_cleanup_close_ int path_fd = -EBADF;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
|
||||
assert(path);
|
||||
assert(ret_stat);
|
||||
|
||||
if (chase_flags & (CHASE_NONEXISTENT|CHASE_STEP))
|
||||
return -EINVAL;
|
||||
|
||||
if (empty_or_root(root) && !ret_path &&
|
||||
(chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_PROHIBIT_SYMLINKS|CHASE_PARENT|CHASE_MKDIR_0755)) == 0 && !ret_fd) {
|
||||
(chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_PROHIBIT_SYMLINKS|CHASE_PARENT|CHASE_MKDIR_0755)) == 0) {
|
||||
/* Shortcut this call if none of the special features of this call are requested */
|
||||
|
||||
if (fstatat(AT_FDCWD, path, ret_stat, FLAGS_SET(chase_flags, CHASE_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0) < 0)
|
||||
@@ -664,8 +662,6 @@ int chase_symlinks_and_stat(
|
||||
|
||||
if (ret_path)
|
||||
*ret_path = TAKE_PTR(p);
|
||||
if (ret_fd)
|
||||
*ret_fd = TAKE_FD(path_fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -675,8 +671,7 @@ int chase_symlinks_and_access(
|
||||
const char *root,
|
||||
ChaseSymlinksFlags chase_flags,
|
||||
int access_mode,
|
||||
char **ret_path,
|
||||
int *ret_fd) {
|
||||
char **ret_path) {
|
||||
|
||||
_cleanup_close_ int path_fd = -EBADF;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
@@ -688,7 +683,7 @@ int chase_symlinks_and_access(
|
||||
return -EINVAL;
|
||||
|
||||
if (empty_or_root(root) && !ret_path &&
|
||||
(chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_PROHIBIT_SYMLINKS|CHASE_PARENT|CHASE_MKDIR_0755)) == 0 && !ret_fd) {
|
||||
(chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_PROHIBIT_SYMLINKS|CHASE_PARENT|CHASE_MKDIR_0755)) == 0) {
|
||||
/* Shortcut this call if none of the special features of this call are requested */
|
||||
|
||||
if (faccessat(AT_FDCWD, path, access_mode, FLAGS_SET(chase_flags, CHASE_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0) < 0)
|
||||
@@ -708,8 +703,6 @@ int chase_symlinks_and_access(
|
||||
|
||||
if (ret_path)
|
||||
*ret_path = TAKE_PTR(p);
|
||||
if (ret_fd)
|
||||
*ret_fd = TAKE_FD(path_fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ int chase_symlinks(const char *path_with_prefix, const char *root, ChaseSymlinks
|
||||
|
||||
int chase_symlinks_and_open(const char *path, const char *root, ChaseSymlinksFlags chase_flags, int open_flags, char **ret_path);
|
||||
int chase_symlinks_and_opendir(const char *path, const char *root, ChaseSymlinksFlags chase_flags, char **ret_path, DIR **ret_dir);
|
||||
int chase_symlinks_and_stat(const char *path, const char *root, ChaseSymlinksFlags chase_flags, char **ret_path, struct stat *ret_stat, int *ret_fd);
|
||||
int chase_symlinks_and_access(const char *path, const char *root, ChaseSymlinksFlags chase_flags, int access_mode, char **ret_path, int *ret_fd);
|
||||
int chase_symlinks_and_stat(const char *path, const char *root, ChaseSymlinksFlags chase_flags, char **ret_path, struct stat *ret_stat);
|
||||
int chase_symlinks_and_access(const char *path, const char *root, ChaseSymlinksFlags chase_flags, int access_mode, char **ret_path);
|
||||
int chase_symlinks_and_fopen_unlocked(const char *path, const char *root, ChaseSymlinksFlags chase_flags, const char *open_flags, char **ret_path, FILE **ret_file);
|
||||
int chase_symlinks_and_unlink(const char *path, const char *root, ChaseSymlinksFlags chase_flags, int unlink_flags, char **ret_path);
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ int null_or_empty_path_with_root(const char *fn, const char *root) {
|
||||
if (path_equal_ptr(path_startswith(fn, root ?: "/"), "dev/null"))
|
||||
return true;
|
||||
|
||||
r = chase_symlinks_and_stat(fn, root, CHASE_PREFIX_ROOT, NULL, &st, NULL);
|
||||
r = chase_symlinks_and_stat(fn, root, CHASE_PREFIX_ROOT, NULL, &st);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ static int install_variables(
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = chase_symlinks_and_access(path, esp_path, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, NULL, NULL);
|
||||
r = chase_symlinks_and_access(path, esp_path, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, NULL);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
|
||||
@@ -560,7 +560,7 @@ static void deref_unlink_file(Hashmap *known_files, const char *fn, const char *
|
||||
return;
|
||||
|
||||
if (arg_dry_run) {
|
||||
r = chase_symlinks_and_access(fn, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, &path, NULL);
|
||||
r = chase_symlinks_and_access(fn, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, &path);
|
||||
if (r < 0)
|
||||
log_info_errno(r, "Unable to determine whether \"%s\" exists, ignoring: %m", fn);
|
||||
else
|
||||
|
||||
@@ -1768,7 +1768,7 @@ static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_er
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"Path to init binary '%s' not absolute.", init);
|
||||
|
||||
r = chase_symlinks_and_access(init, root, CHASE_PREFIX_ROOT, X_OK, NULL, NULL);
|
||||
r = chase_symlinks_and_access(init, root, CHASE_PREFIX_ROOT, X_OK, NULL);
|
||||
if (r == -EACCES)
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||
"Init binary %s is not executable.", init);
|
||||
|
||||
@@ -981,7 +981,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
|
||||
return r;
|
||||
assert(r > 0);
|
||||
|
||||
r = chase_symlinks_and_access(filename, arg_root, CHASE_PREFIX_ROOT, F_OK, &resolved, NULL);
|
||||
r = chase_symlinks_and_access(filename, arg_root, CHASE_PREFIX_ROOT, F_OK, &resolved);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Cannot access \"%s%s\": %m", strempty(arg_root), filename);
|
||||
|
||||
|
||||
@@ -926,7 +926,7 @@ static int mount_inaccessible(const char *dest, CustomMount *m) {
|
||||
assert(dest);
|
||||
assert(m);
|
||||
|
||||
r = chase_symlinks_and_stat(m->destination, dest, CHASE_PREFIX_ROOT, &where, &st, NULL);
|
||||
r = chase_symlinks_and_stat(m->destination, dest, CHASE_PREFIX_ROOT, &where, &st);
|
||||
if (r < 0) {
|
||||
log_full_errno(m->graceful ? LOG_DEBUG : LOG_ERR, r, "Failed to resolve %s/%s: %m", dest, m->destination);
|
||||
return m->graceful ? 0 : r;
|
||||
|
||||
@@ -4021,7 +4021,7 @@ static int add_exclude_path(const char *path, Hashmap **denylist, DenyType type)
|
||||
if (!st)
|
||||
return log_oom();
|
||||
|
||||
r = chase_symlinks_and_stat(path, arg_root, CHASE_PREFIX_ROOT, NULL, st, NULL);
|
||||
r = chase_symlinks_and_stat(path, arg_root, CHASE_PREFIX_ROOT, NULL, st);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
|
||||
@@ -1269,7 +1269,7 @@ static void boot_entry_file_list(
|
||||
assert(p);
|
||||
assert(ret_status);
|
||||
|
||||
int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, NULL, NULL);
|
||||
int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, NULL);
|
||||
|
||||
/* Note that this shows two '/' between the root and the file. This is intentional to highlight (in
|
||||
* the absence of color support) to the user that the boot loader is only interested in the second
|
||||
|
||||
@@ -21,11 +21,11 @@ static int same_file_in_root(
|
||||
struct stat sta, stb;
|
||||
int r;
|
||||
|
||||
r = chase_symlinks_and_stat(a, root, CHASE_PREFIX_ROOT, NULL, &sta, NULL);
|
||||
r = chase_symlinks_and_stat(a, root, CHASE_PREFIX_ROOT, NULL, &sta);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = chase_symlinks_and_stat(b, root, CHASE_PREFIX_ROOT, NULL, &stb, NULL);
|
||||
r = chase_symlinks_and_stat(b, root, CHASE_PREFIX_ROOT, NULL, &stb);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user