aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/loop.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libbb/loop.c b/libbb/loop.c
index 8e5c915fc..256b7ac90 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -188,13 +188,9 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse
188 /* If device is free, try to claim it */ 188 /* If device is free, try to claim it */
189 if (rc && errno == ENXIO) { 189 if (rc && errno == ENXIO) {
190 /* Associate free loop device with file */ 190 /* Associate free loop device with file */
191 if (ioctl(lfd, LOOP_SET_FD, ffd)) { 191 rc = ioctl(lfd, LOOP_SET_FD, ffd);
192 /* Ouch. Are we racing with other mount? */ 192 if (rc != 0) {
193 if (!*device) { 193 /* Ouch... race: the device already has a fd */
194 close(lfd);
195//TODO: add "if (--failcount != 0) ..."?
196 continue;
197 }
198 goto close_and_try_next_loopN; 194 goto close_and_try_next_loopN;
199 } 195 }
200 memset(&loopinfo, 0, sizeof(loopinfo)); 196 memset(&loopinfo, 0, sizeof(loopinfo));