# HG changeset patch
# User Yongjie Ren <yongjie.ren@xxxxxxxxx>
# Date 1308666694 -3600
# Node ID b17fbeed15488dfa789d8cff0eca6a5808479a41
# Parent c91255b2f0a047a2fdf69633a19cdc0b10ea60a5
libxl: remove O_CLOEXEC in xl_cmdimpl.c
Some old linux kernels such as 2.6.18 don't define O_CLOEXEC, so
remove O_CLOEXEC in xl_cmdimpl.c and replace with fcntl.
Signed-off-by: Yongjie Ren <yongjie.ren@xxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r c91255b2f0a0 -r b17fbeed1548 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Mon Jun 20 13:16:14 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c Tue Jun 21 15:31:34 2011 +0100
@@ -199,11 +199,16 @@
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 0;
- fd_lock = open(lockfile, O_WRONLY|O_CREAT|O_CLOEXEC, S_IWUSR);
+ fd_lock = open(lockfile, O_WRONLY|O_CREAT, S_IWUSR);
if (fd_lock < 0) {
fprintf(stderr, "cannot open the lockfile %s errno=%d\n", lockfile,
errno);
return ERROR_FAIL;
}
+ if (fcntl(fd_lock, F_SETFD, FD_CLOEXEC) < 0) {
+ close(fd_lock);
+ fprintf(stderr, "cannot set cloexec to lockfile %s errno=%d\n",
lockfile, errno);
+ return ERROR_FAIL;
+ }
get_lock:
rc = fcntl(fd_lock, F_SETLKW, &fl);
if (rc < 0 && errno == EINTR)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|