summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Jacob <mjacob@FreeBSD.org>2001-07-04 07:43:10 +0000
committerMatt Jacob <mjacob@FreeBSD.org>2001-07-04 07:43:10 +0000
commit3d09a65d42722de5d9fb09c52c1b45f683a2c8bd (patch)
tree485683b31fb4390e7b645725ccb8cc007203b903
parentd79bee64d07120bb6481467dce7b038f8fbd5518 (diff)
Notes
-rw-r--r--lib/libcam/camlib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c
index 7c2a6cdc3ecb..1c76303a8c8b 100644
--- a/lib/libcam/camlib.c
+++ b/lib/libcam/camlib.c
@@ -554,7 +554,7 @@ cam_real_open_device(const char *path, int flags, struct cam_device *device,
char newpath[MAXPATHLEN+1];
char *func_name = "cam_real_open_device";
union ccb ccb;
- int fd, malloced_device = 0;
+ int fd = -1, malloced_device = 0;
/*
* See if the user wants us to malloc a device for him.
@@ -567,6 +567,7 @@ cam_real_open_device(const char *path, int flags, struct cam_device *device,
strerror(errno));
return(NULL);
}
+ device->fd = -1;
malloced_device = 1;
}
@@ -691,6 +692,9 @@ cam_real_open_device(const char *path, int flags, struct cam_device *device,
crod_bailout:
+ if (fd >= 0)
+ close(fd);
+
if (malloced_device)
free(device);