summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-11 15:17:37 +0200
committerSimon Rettberg2019-07-11 15:17:37 +0200
commitb8152cf67ad0995d34debbedcc374da46e3b217c (patch)
treeda7759ddfcb0a49eae932d3d0fee1346892bcd0b
parentSlightly more consistent naming (diff)
downloadidle-daemon-b8152cf67ad0995d34debbedcc374da46e3b217c.tar.gz
idle-daemon-b8152cf67ad0995d34debbedcc374da46e3b217c.tar.xz
idle-daemon-b8152cf67ad0995d34debbedcc374da46e3b217c.zip
Fix fd leak
-rw-r--r--src/rpc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpc.c b/src/rpc.c
index 40c2b0d..33df75b 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -91,8 +91,10 @@ void rpc_handle( int listenFd )
close( fd ); // TODO: Allow more for root (eg. cancel reboot/poweroff)
continue;
}
- if ( ! doublefork() )
+ if ( ! doublefork() ) {
+ close( fd );
continue; // Parent continues
+ }
handleClient( fd, &ucred );
exit( 0 );
}