mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Fix coverity defects: CID 147536, 147537, 147538
coverity scan CID:147536, type: Argument cannot be negative - may write or close fd which is negative coverity scan CID:147537, type: Argument cannot be negative - may call dup2 with a negative fd coverity scan CID:147538, type: Argument cannot be negative - may read or fchown with a negative fd Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: GeLiXin <ge.lixin@zte.com.cn> Closes #5185
This commit is contained in:
committed by
Brian Behlendorf
parent
292d573e70
commit
ed3ea30fb9
Regular → Executable
+5
-4
@@ -106,10 +106,11 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
|
||||
return;
|
||||
} else if (pid == 0) {
|
||||
(void) umask(022);
|
||||
fd = open("/dev/null", O_RDWR);
|
||||
(void) dup2(fd, STDIN_FILENO);
|
||||
(void) dup2(fd, STDOUT_FILENO);
|
||||
(void) dup2(fd, STDERR_FILENO);
|
||||
if ((fd = open("/dev/null", O_RDWR)) != -1) {
|
||||
(void) dup2(fd, STDIN_FILENO);
|
||||
(void) dup2(fd, STDOUT_FILENO);
|
||||
(void) dup2(fd, STDERR_FILENO);
|
||||
}
|
||||
(void) dup2(zfd, ZEVENT_FILENO);
|
||||
zed_file_close_from(ZEVENT_FILENO + 1);
|
||||
execle(path, prog, NULL, env);
|
||||
|
||||
Reference in New Issue
Block a user