mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
Set CLOEXEC flag on the inotify file descriptor
This commit is contained in:
parent
eeb1a6a0d7
commit
0fd23a6f7e
10
src/conky.cc
10
src/conky.cc
@ -3291,8 +3291,6 @@ int main(int argc, char **argv)
|
|||||||
std::cerr << "caught exception: " << e.what() << std::endl;
|
std::cerr << "caught exception: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
|
||||||
//////////// XXX ////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef BUILD_WEATHER_XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
/* Load xoap keys, if existing */
|
/* Load xoap keys, if existing */
|
||||||
@ -3300,14 +3298,16 @@ int main(int argc, char **argv)
|
|||||||
#endif /* BUILD_WEATHER_XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
#ifdef HAVE_SYS_INOTIFY_H
|
#ifdef HAVE_SYS_INOTIFY_H
|
||||||
|
// the file descriptor will be automatically closed on exit
|
||||||
inotify_fd = inotify_init();
|
inotify_fd = inotify_init();
|
||||||
if(inotify_fd != -1) {
|
if(inotify_fd != -1) {
|
||||||
int fl;
|
fcntl(inotify_fd, F_SETFL, fcntl(inotify_fd, F_GETFL) | O_NONBLOCK);
|
||||||
|
|
||||||
fl = fcntl(inotify_fd, F_GETFL);
|
fcntl(inotify_fd, F_SETFD, fcntl(inotify_fd, F_GETFD) | FD_CLOEXEC);
|
||||||
fcntl(inotify_fd, F_SETFL, fl | O_NONBLOCK);
|
|
||||||
}
|
}
|
||||||
#endif /* HAVE_SYS_INOTIFY_H */
|
#endif /* HAVE_SYS_INOTIFY_H */
|
||||||
|
return 0;
|
||||||
|
//////////// XXX ////////////////////////////////
|
||||||
|
|
||||||
initialisation(argc, argv);
|
initialisation(argc, argv);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user