aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2006-04-30 07:08:43 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2006-04-30 07:08:43 +0000
commita7a6dfbd14e3b65d66ed934e4ce18abfdf73ada0 (patch)
treee51bd7d3ceab3db7552b0202784da236860bbf75 /lib
parent8bc181f5069dc14b657a474446d73491fa60fbf4 (diff)
downloadsrc-a7a6dfbd14e3b65d66ed934e4ce18abfdf73ada0.tar.gz
src-a7a6dfbd14e3b65d66ed934e4ce18abfdf73ada0.zip
Go with a different version of the previous patch so to preserve errno.
Approved by: scottl (implicit)
Notes
Notes: svn path=/head/; revision=158171
Diffstat (limited to 'lib')
-rw-r--r--lib/libcam/camlib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c
index 88191ee9f4df..b2523719ed0a 100644
--- a/lib/libcam/camlib.c
+++ b/lib/libcam/camlib.c
@@ -465,7 +465,7 @@ static struct cam_device *
cam_lookup_pass(const char *dev_name, int unit, int flags,
const char *given_path, struct cam_device *device)
{
- int fd, rc;
+ int fd;
union ccb ccb;
char dev_path[256];
char *func_name = "cam_lookup_pass";
@@ -494,10 +494,7 @@ cam_lookup_pass(const char *dev_name, int unit, int flags,
* the device name is null, if the device doesn't exist, or if the
* passthrough driver isn't in the kernel.
*/
- rc = ioctl(fd, CAMGETPASSTHRU, &ccb);
- close(fd);
-
- if (rc == -1) {
+ if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
char tmpstr[256];
/*
@@ -517,9 +514,12 @@ cam_lookup_pass(const char *dev_name, int unit, int flags,
"%s: %s%s", func_name, func_name, strerror(errno),
(errno == ENOENT) ? tmpstr : "");
+ close(fd);
return(NULL);
}
+ close(fd);
+
/*
* If the ioctl returned the right status, but we got an error back
* in the ccb, that means that the kernel found the device the user