If the open fails, then there is no need to close the file descriptor. If it succeed, it will be closed after being used.
Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]> --- samsung-ipc/ipc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 7df57ec..2512d29 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -70,7 +70,6 @@ int ipc_device_detect(void) length = read(fd, &buffer, sizeof(buffer)); close(fd); - fd = -1; line = strtok(buffer, "\n"); while (line != NULL) { @@ -147,9 +146,6 @@ complete: if (kernel_version != NULL) free(kernel_version); - if (fd >= 0) - close(fd); - return index; } -- 2.25.0 _______________________________________________ Replicant mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/replicant
