Merge pull request #32286 from YHNdnzj/vpick-null-result

shared/vpick: add missing condition on ret_result
This commit is contained in:
Luca Boccassi 2024-04-15 22:36:12 +02:00 committed by GitHub
commit 091c26ba9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -141,8 +141,7 @@ static int pin_choice(
assert(toplevel_fd >= 0 || toplevel_fd == AT_FDCWD);
assert(inode_path);
assert(filter);
toplevel_path = strempty(toplevel_path);
assert(ret);
if (inode_fd < 0 || FLAGS_SET(flags, PICK_RESOLVE)) {
r = chaseat(toplevel_fd,
@ -271,8 +270,7 @@ static int make_choice(
assert(toplevel_fd >= 0 || toplevel_fd == AT_FDCWD);
assert(inode_path);
assert(filter);
toplevel_path = strempty(toplevel_path);
assert(ret);
if (inode_fd < 0) {
r = chaseat(toplevel_fd, inode_path, CHASE_AT_RESOLVE_IN_ROOT, NULL, &inode_fd);
@ -486,7 +484,8 @@ static int make_choice(
ret);
}
int path_pick(const char *toplevel_path,
int path_pick(
const char *toplevel_path,
int toplevel_fd,
const char *path,
const PickFilter *filter,
@ -500,8 +499,8 @@ int path_pick(const char *toplevel_path,
assert(toplevel_fd >= 0 || toplevel_fd == AT_FDCWD);
assert(path);
toplevel_path = strempty(toplevel_path);
assert(filter);
assert(ret);
/* Given a path, resolve .v/ subdir logic (if used!), and returns the choice made. This supports
* three ways to be called:
@ -647,6 +646,7 @@ int path_pick_update_warn(
assert(path);
assert(*path);
assert(filter);
/* This updates the first argument if needed! */
@ -658,6 +658,8 @@ int path_pick_update_warn(
&result);
if (r == -ENOENT) {
log_debug("Path '%s' doesn't exist, leaving as is.", *path);
if (ret_result)
*ret_result = PICK_RESULT_NULL;
return 0;
}