Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-12-13 17:49:09 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-12-13 17:52:52 +0300
commita55bd1c4847dda99cf9e65519ed67f3bcc9786d8 (patch)
tree31fe31365a5bd148dfa30aa499c139334ca86a3b
parent45734a23515b3e1f2305ad33dc22d1bc69e3cba6 (diff)
loop: restore the correct return vaule of set_loop()
It is only used by mount's error path, though... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/loop.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libbb/loop.c b/libbb/loop.c
index e930b1b1f..ffc8acd39 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -147,10 +147,8 @@ static int set_loopdev_params(int lfd,
loopinfo.lo_offset = offset;
loopinfo.lo_sizelimit = sizelimit;
/*
- * Used by mount to set LO_FLAGS_AUTOCLEAR.
- * LO_FLAGS_READ_ONLY is not set because RO is controlled by open type of the file.
- * Note that closing LO_FLAGS_AUTOCLEARed lfd before mount
- * is wrong (would free the loop device!)
+ * LO_FLAGS_READ_ONLY is not set because RO is controlled
+ * by open type of the lfd.
*/
loopinfo.lo_flags = (flags & ~BB_LO_FLAGS_READ_ONLY);
@@ -266,6 +264,12 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse
/* SUCCESS! */
if (!*device)
*device = xstrdup(dev);
+ /* Note: mount asks for LO_FLAGS_AUTOCLEAR loopdev.
+ * Closing LO_FLAGS_AUTOCLEARed lfd before mount
+ * is wrong (would free the loop device!),
+ * this is why we return without closing it.
+ */
+ rc = lfd; /* return this */
break;
}
close(lfd);