diff options
author | ngie <ngie@FreeBSD.org> | 2015-10-26 00:08:40 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-10-26 00:08:40 +0000 |
commit | 2d4f06f66b0b26f0a24a795bcfc182bfba3f0ec6 (patch) | |
tree | 4d4749321f0c130bc4021ac49367179d7f8e35b6 | |
parent | 240202305e59277c863bc74a60115cc4bd40ea58 (diff) | |
download | FreeBSD-src-2d4f06f66b0b26f0a24a795bcfc182bfba3f0ec6.zip FreeBSD-src-2d4f06f66b0b26f0a24a795bcfc182bfba3f0ec6.tar.gz |
MFC r289450:
Set dev->fd to -1 when calling cam_close_spec_device with a valid dev->fd
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>
Sponsored by: EMC / Isilon Storage Division
-rw-r--r-- | lib/libcam/camlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c index f320247..b7024a6 100644 --- a/lib/libcam/camlib.c +++ b/lib/libcam/camlib.c @@ -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 * |