changeset 1464:836ff051a071 draft

Don't close device handle until after calling flush ioctls, reported by Ashwini Sharma.
author Rob Landley <rob@landley.net>
date Mon, 08 Sep 2014 08:40:06 -0500
parents bdd42c1463f8
children 2148d1502264
files toys/other/nbd_client.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/toys/other/nbd_client.c	Mon Sep 08 08:26:02 2014 -0500
+++ b/toys/other/nbd_client.c	Mon Sep 08 08:40:06 2014 -0500
@@ -119,10 +119,9 @@
     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);
 }