No need to check if fd_dst is -1 in sudoedit mode.
Failure to open the destination sudoedit file is fatal so there's no need to check that fd_dst != -1 later on. Found by PVS-Studio.
This commit is contained in:
@@ -221,7 +221,6 @@ sesh_sudoedit(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (fd_dst != -1) {
|
||||
if (!post) {
|
||||
if (fd_src == -1 || fstat(fd_src, &sb) != 0)
|
||||
memset(&sb, 0, sizeof(sb));
|
||||
@@ -235,10 +234,11 @@ sesh_sudoedit(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
close(fd_dst);
|
||||
}
|
||||
if (fd_src != -1)
|
||||
fd_dst = -1;
|
||||
if (fd_src != -1) {
|
||||
close(fd_src);
|
||||
fd_dst = fd_src = -1;
|
||||
fd_src = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = SESH_SUCCESS;
|
||||
|
Reference in New Issue
Block a user