From: Yu Watanabe Date: Tue, 3 Feb 2026 15:07:02 +0000 (+0900) Subject: mountpoint-util: make name_to_handle_at_loop() gracefully handle NULL path X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09811ccaa1aa3146e5c72c3090105b02007cedba;p=thirdparty%2Fsystemd.git mountpoint-util: make name_to_handle_at_loop() gracefully handle NULL path --- diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index 9c04d381f39..3bb82ef239b 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -63,6 +63,11 @@ int name_to_handle_at_loop( * This improves on raw name_to_handle_at() also in one other regard: ret_handle and ret_mnt_id can be passed * as NULL if there's no interest in either. */ + if (isempty(path)) { + flags |= AT_EMPTY_PATH; + path = ""; + } + for (;;) { _cleanup_free_ struct file_handle *h = NULL; int mnt_id = -1; @@ -73,7 +78,7 @@ int name_to_handle_at_loop( h->handle_bytes = n; - if (name_to_handle_at(fd, strempty(path), h, &mnt_id, flags) >= 0) { + if (name_to_handle_at(fd, path, h, &mnt_id, flags) >= 0) { if (ret_handle) *ret_handle = TAKE_PTR(h);