aboutsummaryrefslogtreecommitdiff
path: root/toys/other/losetup.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-02-08 03:08:26 -0600
committerRob Landley <rob@landley.net>2021-02-08 03:08:26 -0600
commita079039934311f64a48e1010a97492a22126042e (patch)
treedf156add0a45e445c57dd70354cd7e2f85ff697f /toys/other/losetup.c
parentbdb0e5fd6e031f9b3fae95d8180cf6bba32384c8 (diff)
downloadtoybox-a079039934311f64a48e1010a97492a22126042e.tar.gz
Have xclose() perform the fd != -1 test.
Diffstat (limited to 'toys/other/losetup.c')
-rw-r--r--toys/other/losetup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/other/losetup.c b/toys/other/losetup.c
index 27d25a18..7b8aed4f 100644
--- a/toys/other/losetup.c
+++ b/toys/other/losetup.c
@@ -52,7 +52,7 @@ GLOBALS(
static int loopback_setup(char *device, char *file)
{
struct loop_info64 *loop = (void *)(toybuf+32);
- int lfd = -1, ffd = ffd;
+ int lfd = -1, ffd = -1;
int racy = !device;
// Open file (ffd) and loop device (lfd)
@@ -129,8 +129,8 @@ static int loopback_setup(char *device, char *file)
}
done:
- if (file) close(ffd);
- if (lfd != -1) close(lfd);
+ xclose(ffd);
+ xclose(lfd);
return 0;
}