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

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,12 +484,13 @@ static int make_choice(
ret);
}
int path_pick(const char *toplevel_path,
int toplevel_fd,
const char *path,
const PickFilter *filter,
PickFlags flags,
PickResult *ret) {
int path_pick(
const char *toplevel_path,
int toplevel_fd,
const char *path,
const PickFilter *filter,
PickFlags flags,
PickResult *ret) {
_cleanup_free_ char *filter_bname = NULL, *dir = NULL, *parent = NULL, *fname = NULL;
const char *filter_suffix, *enumeration_path;
@@ -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,7 +658,9 @@ int path_pick_update_warn(
&result);
if (r == -ENOENT) {
log_debug("Path '%s' doesn't exist, leaving as is.", *path);
*ret_result = PICK_RESULT_NULL;
if (ret_result)
*ret_result = PICK_RESULT_NULL;
return 0;
}
if (r < 0)