From 16420be1fdd4a1430b4216d1ae9155914175ed42 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 31 Dec 2018 17:00:10 +0100 Subject: [PATCH] loop-util: tweak codepath when a loopback file is "created" from an existing block device Be more careful with initialized of the 'relinquished' boolean field, and let's return the fd, like we do for the regular codepath, too. --- src/shared/loop-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index e77eee6..bf426eb 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -45,11 +45,11 @@ int loop_device_make(int fd, int open_flags, LoopDevice **ret) { *d = (LoopDevice) { .fd = copy, .nr = -1, + .relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */ }; *ret = d; - - return 0; + return d->fd; } r = stat_verify_regular(&st); -- 2.7.4