From 2d4f06f66b0b26f0a24a795bcfc182bfba3f0ec6 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 26 Oct 2015 00:08:40 +0000 Subject: [PATCH] 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 Sponsored by: EMC / Isilon Storage Division --- lib/libcam/camlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c index f3202470a0e2..b7024a6d6097 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 *