diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-17 23:38:06 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-17 23:38:06 +0100 |
commit | 15733cb48e570716cad6ece2d752507ecd767131 (patch) | |
tree | 76b2de515344b892b841192e5961b660ff0da656 /libbb | |
parent | 251e08ffa626d4b7c7e5f626aee7067b86b2ceba (diff) | |
download | busybox-w32-15733cb48e570716cad6ece2d752507ecd767131.tar.gz busybox-w32-15733cb48e570716cad6ece2d752507ecd767131.tar.bz2 busybox-w32-15733cb48e570716cad6ece2d752507ecd767131.zip |
mount: if we race with other loop mount, we forget to close loop dev
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/loop.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/loop.c b/libbb/loop.c index 153990998..cb8fa2442 100644 --- a/libbb/loop.c +++ b/libbb/loop.c | |||
@@ -187,7 +187,7 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse | |||
187 | //TODO: add "if (--failcount != 0) ..."? | 187 | //TODO: add "if (--failcount != 0) ..."? |
188 | goto get_free_loopN; | 188 | goto get_free_loopN; |
189 | } | 189 | } |
190 | goto try_next_loopN; | 190 | goto close_and_try_next_loopN; |
191 | } | 191 | } |
192 | memset(&loopinfo, 0, sizeof(loopinfo)); | 192 | memset(&loopinfo, 0, sizeof(loopinfo)); |
193 | safe_strncpy((char *)loopinfo.lo_file_name, file, LO_NAME_SIZE); | 193 | safe_strncpy((char *)loopinfo.lo_file_name, file, LO_NAME_SIZE); |
@@ -220,6 +220,7 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse | |||
220 | ioctl(lfd, LOOP_CLR_FD, 0); // actually, 0 param is unnecessary | 220 | ioctl(lfd, LOOP_CLR_FD, 0); // actually, 0 param is unnecessary |
221 | } | 221 | } |
222 | /* else: device is not free (rc == 0) or error other than ENXIO */ | 222 | /* else: device is not free (rc == 0) or error other than ENXIO */ |
223 | close_and_try_next_loopN: | ||
223 | close(lfd); | 224 | close(lfd); |
224 | try_next_loopN: | 225 | try_next_loopN: |
225 | rc = -1; | 226 | rc = -1; |