Fix for error handling
authorJean Wolter <jean@sec.t-labs.tu-berlin.de>
Wed, 2 May 2012 14:43:25 +0000 (16:43 +0200)
committerWouter Verhelst <w@uter.be>
Wed, 2 May 2012 14:44:50 +0000 (16:44 +0200)
commit5bd1679e51b9e3cc4825323ec6c11eab827507c2
tree50d143512139ec429ba84f7384e113902bdd4d48
parent1ee57a842170233980b3d51487172d741198df51
Fix for error handling

When a client disconnects from the nbd device (triggered via nbd-client
-d <nbd device>) the ioctl(nbd, NBD_DO_IT) returns with an error.
nbd-client checks errno to figure out whether it was disconnected and
whether it should terminate or not. Unfortunatly it invokes fprintf()
before checking errno and fprintf overwrites the current value of errno.
The attached patch saves the current value of errno and checks the saved
value.
nbd-client.c