diff options
Diffstat (limited to 'lib')
-rwxr-xr-x[-rw-r--r--] | lib/libshare/nfs.c | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/libzpool/kernel.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c index d1b207e65..abcc1025b 100644..100755 --- a/lib/libshare/nfs.c +++ b/lib/libshare/nfs.c @@ -519,6 +519,7 @@ nfs_validate_shareopts(const char *shareopts) static boolean_t nfs_is_share_active(sa_share_impl_t impl_share) { + int fd; char line[512]; char *tab, *cur; FILE *nfs_exportfs_temp_fp; @@ -526,7 +527,10 @@ nfs_is_share_active(sa_share_impl_t impl_share) if (!nfs_available()) return (B_FALSE); - nfs_exportfs_temp_fp = fdopen(dup(nfs_exportfs_temp_fd), "r"); + if ((fd = dup(nfs_exportfs_temp_fd)) == -1) + return (B_FALSE); + + nfs_exportfs_temp_fp = fdopen(fd, "r"); if (nfs_exportfs_temp_fp == NULL || fseek(nfs_exportfs_temp_fp, 0, SEEK_SET) < 0) { diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 7ac505a64..60dda39a8 100644..100755 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -668,7 +668,11 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3) * FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR. */ fd = open64(realpath, flags - FREAD, mode); - err = errno; + if (fd == -1) { + err = errno; + free(realpath); + return (err); + } if (flags & FCREAT) (void) umask(old_umask); @@ -691,9 +695,6 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3) free(realpath); - if (fd == -1) - return (err); - if (fstat64_blk(fd, &st) == -1) { err = errno; close(fd); @@ -740,7 +741,7 @@ vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, offset_t offset, if (uio == UIO_READ) { rc = pread64(vp->v_fd, addr, len, offset); - if (vp->v_dump_fd != -1) { + if (vp->v_dump_fd != -1 && rc != -1) { int status; status = pwrite64(vp->v_dump_fd, addr, rc, offset); ASSERT(status != -1); |