summaryrefslogtreecommitdiff
path: root/nfcommander.c
diff options
context:
space:
mode:
Diffstat (limited to 'nfcommander.c')
-rw-r--r--nfcommander.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nfcommander.c b/nfcommander.c
index 0521fc4..50cbda7 100644
--- a/nfcommander.c
+++ b/nfcommander.c
@@ -42,6 +42,10 @@ int core_manage_fd(int fd, int manage, notification_target_t system){
.data.u64 = data.u64
};
+ if(fd < 0){
+ return 0;
+ }
+
if(epoll_ctl(epoll_fd, manage ? EPOLL_CTL_ADD : EPOLL_CTL_DEL, fd, &event)){
fprintf(stderr, "Failed to modify epoll instance\n");
shutdown_requested = 1;
@@ -119,10 +123,10 @@ int main(int argc, char** argv){
}
//clean up
- close(epoll_fd);
- epoll_fd = -1;
reader_free();
control_free();
command_free();
config_free();
+ close(epoll_fd);
+ epoll_fd = -1;
}