aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-09-08 08:40:06 -0500
committerRob Landley <rob@landley.net>2014-09-08 08:40:06 -0500
commit12eff430e9d20c62fa9cc81d0b6ecface61bac18 (patch)
treee9bd97fb425474094b932dc8c4fbb9a7996a7744 /toys/other
parent6634e46216410161f0f56dc54b16da2de6a8f2b3 (diff)
downloadtoybox-12eff430e9d20c62fa9cc81d0b6ecface61bac18.tar.gz
Don't close device handle until after calling flush ioctls, reported by Ashwini Sharma.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/nbd_client.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/toys/other/nbd_client.c b/toys/other/nbd_client.c
index 33787d77..6b437c72 100644
--- a/toys/other/nbd_client.c
+++ b/toys/other/nbd_client.c
@@ -119,10 +119,9 @@ void nbd_client_main(void)
if (ioctl(nbd, NBD_DO_IT)>=0 || errno==EBADR) break;
close(sock);
}
- close(nbd);
// Flush queue and exit.
-
ioctl(nbd, NBD_CLEAR_QUE);
ioctl(nbd, NBD_CLEAR_SOCK);
+ if (CFG_TOYBOX_FREE) close(nbd);
}