]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: make loop_device_make() return fd in all code paths
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 08:46:34 +0000 (10:46 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 15:12:39 +0000 (17:12 +0200)
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).

src/shared/loop-util.c

index 2aa4936965429bc25155d3f2fbf5192da43b48d7..9ec2f0c1abac9378516a3510afd5a2958ffb61fb 100644 (file)
@@ -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) {