mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-27 04:32:16 +03:00
Fix coverity defects: CID 147531 147532 147533 147535
coverity scan CID:147531,type: Argument cannot be negative - may copy data with negative size coverity scan CID:147532,type: resource leaks - may close a fd which is negative coverity scan CID:147533,type: resource leaks - may call pwrite64 with a negative size coverity scan CID:147535,type: resource leaks - may call fdopen with a negative fd Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: GeLiXin <ge.lixin@zte.com.cn> Closes #5176
This commit is contained in:
committed by
Brian Behlendorf
parent
ed3ea30fb9
commit
470f12d631
Regular → Executable
+5
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user