From: Lennart Poettering Date: Tue, 20 Apr 2021 08:46:34 +0000 (+0200) Subject: loop-util: make loop_device_make() return fd in all code paths X-Git-Tag: v249-rc1~380^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=38bd449f9617228e92dacf7fc0415d2f13b97af2;p=thirdparty%2Fsystemd.git loop-util: make loop_device_make() return fd in all code paths Previously, loop_device_make() would return the device fd in one success code path, but not the other (where' we'd just return 0). loop_device_open() returns it in all cases. Hence, let's clean this up, and make sure in all success code paths of both functions we return it (even though it strictly speaking is redundant, since we return it in LoopDevice anyway, and currently noone actually relies on this). --- diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index 2aa49369654..9ec2f0c1aba 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -441,7 +441,7 @@ int loop_device_make( }; *ret = d; - return 0; + return d->fd; } int loop_device_make_by_path(const char *path, int open_flags, uint32_t loop_flags, LoopDevice **ret) {