Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2015 09:07:54 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289450 - head/lib/libcam
Message-ID:  <201510170907.t9H97sgF066102@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Oct 17 09:07:53 2015
New Revision: 289450
URL: https://svnweb.freebsd.org/changeset/base/289450

Log:
  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

Modified:
  head/lib/libcam/camlib.c

Modified: head/lib/libcam/camlib.c
==============================================================================
--- head/lib/libcam/camlib.c	Sat Oct 17 08:51:10 2015	(r289449)
+++ head/lib/libcam/camlib.c	Sat Oct 17 09:07:53 2015	(r289450)
@@ -676,8 +676,10 @@ cam_close_spec_device(struct cam_device 
 	if (dev == NULL)
 		return;
 
-	if (dev->fd >= 0)
+	if (dev->fd >= 0) {
 		close(dev->fd);
+		dev->fd = -1;
+	}
 }
 
 char *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510170907.t9H97sgF066102>