diff options
author | ngie <ngie@FreeBSD.org> | 2015-10-17 09:07:53 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-10-17 09:07:53 +0000 |
commit | 8274c9ca5f94449626c9a69121df86e5d6ffeb1e (patch) | |
tree | 5116318b7f15038121ac6478177af7e2d6821a2c /lib | |
parent | 42e86731a7458e60ee9aa9d82a479ebb1d2611e3 (diff) | |
download | FreeBSD-src-8274c9ca5f94449626c9a69121df86e5d6ffeb1e.zip FreeBSD-src-8274c9ca5f94449626c9a69121df86e5d6ffeb1e.tar.gz |
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>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib')
-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 * |