]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Set dev->fd to -1 when calling cam_close_spec_device with a valid dev->fd
authorngie <ngie@FreeBSD.org>
Sat, 17 Oct 2015 09:07:53 +0000 (09:07 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 17 Oct 2015 09:07:53 +0000 (09:07 +0000)
descriptor to avoid trashing valid file descriptors that access dev->fd at a
later point in time

PR: 192671
Submitted by: Scott Ferris <scott.ferris@isilon.com>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

lib/libcam/camlib.c

index f3202470a0e209a2497d51b78450c21f9c7aa6f0..b7024a6d60973d3c78f556590301cc2e3e034fcd 100644 (file)
@@ -676,8 +676,10 @@ cam_close_spec_device(struct cam_device *dev)
        if (dev == NULL)
                return;
 
-       if (dev->fd >= 0)
+       if (dev->fd >= 0) {
                close(dev->fd);
+               dev->fd = -1;
+       }
 }
 
 char *