eio: Check return code of fcntl()

CID 1039686
This commit is contained in:
Stefan Schmidt 2013-08-07 15:05:34 +01:00
parent 824bf92dad
commit d2f8eaf6c8
1 changed files with 4 additions and 2 deletions

View File

@ -168,7 +168,7 @@ void eio_monitor_backend_init(void)
{ {
int fd; int fd;
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
int flags; int flags, rc;
#endif #endif
fd = inotify_init(); fd = inotify_init();
@ -178,7 +178,9 @@ void eio_monitor_backend_init(void)
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
flags = fcntl(fd, F_GETFD); flags = fcntl(fd, F_GETFD);
flags |= FD_CLOEXEC; flags |= FD_CLOEXEC;
fcntl(fd, F_SETFD, flags); rc = fcntl(fd, F_SETFD, flags);
if (rc < 0)
return;
#endif #endif
_inotify_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _eio_inotify_handler, NULL, NULL, NULL); _inotify_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _eio_inotify_handler, NULL, NULL, NULL);