Use gnulib set_cloexec_flag in a few places.

This commit is contained in:
Richard W.M. Jones
2017-03-03 14:16:22 +00:00
parent 58d6becc8a
commit e5474df1ac
3 changed files with 13 additions and 9 deletions

View File

@@ -29,6 +29,7 @@
#include <sys/inotify.h>
#endif
#include "cloexec.h"
#include "nonblocking.h"
#include "guestfs_protocol.h"
@@ -120,8 +121,8 @@ do_inotify_init (int max_events)
inotify_fd = -1;
return -1;
}
if (fcntl (inotify_fd, F_SETFD, FD_CLOEXEC) == -1) {
reply_with_perror ("fcntl: FD_CLOEXEC");
if (set_cloexec_flag (inotify_fd, 1) == -1) {
reply_with_perror ("set_cloexec_flag");
close (inotify_fd);
inotify_fd = -1;
return -1;