diff options
author | Andrew Stanley-Jones <andrew.stanley-jones@nokia.com> | 2012-07-04 11:19:56 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-13 04:41:04 +0200 |
commit | fea5ebd5adc1c069ba547996ee392190576cc700 (patch) | |
tree | 3f6a18935e1216a07d0e7a58f7c57c7a503ed26c /src/serviceframework | |
parent | c2185fc3959cce30fcea3d769019c096f3c58335 (diff) |
OSX 10.6 doesn't define O_CLOEXEC so don't use it
When using fcntl use FD_CLOEXEC instead since it's supported
on all platforms.
Change-Id: I549d5ed684447a05c1dbabae6c0dc1f6cb1ad381
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'src/serviceframework')
-rw-r--r-- | src/serviceframework/ipc/qremoteserviceregister_unix_p.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/serviceframework/ipc/qremoteserviceregister_unix_p.cpp b/src/serviceframework/ipc/qremoteserviceregister_unix_p.cpp index 01de10e3..f6365a9d 100644 --- a/src/serviceframework/ipc/qremoteserviceregister_unix_p.cpp +++ b/src/serviceframework/ipc/qremoteserviceregister_unix_p.cpp @@ -239,7 +239,8 @@ UnixEndPoint::UnixEndPoint(int client_fd, QObject* parent) QObject::connect(writeNotifier, SIGNAL(activated(int)), this, SLOT(flushWriteBuffer())); int flags = fcntl(client_fd, F_GETFL, 0); - fcntl(client_fd, F_SETFL, flags|O_NONBLOCK|O_CLOEXEC); + fcntl(client_fd, F_SETFL, flags|O_NONBLOCK); + fcntl(client_fd, F_SETFD, FD_CLOEXEC); qServiceLog() << "class" << "unixep" << "event" << "new" @@ -745,7 +746,8 @@ void QRemoteServiceRegisterUnixPrivate::processIncoming() int client_fd = ::accept(server_fd, (struct sockaddr *) &name, (socklen_t *) &len); int flags = ::fcntl(client_fd, F_GETFL, 0); - ::fcntl(client_fd, F_SETFL, flags|O_NONBLOCK|FD_CLOEXEC); + ::fcntl(client_fd, F_SETFL, flags|O_NONBLOCK); + ::fcntl(client_fd, F_SETFD, FD_CLOEXEC); qServiceLog() << "class" << "qrsrup" << "event" << "accept" @@ -787,7 +789,8 @@ bool QRemoteServiceRegisterUnixPrivate::createServiceEndPoint(const QString& ide } int flags = fcntl(server_fd, F_GETFL, 0); - fcntl(server_fd, F_SETFL, flags|O_NONBLOCK|O_CLOEXEC); + fcntl(server_fd, F_SETFL, flags|O_NONBLOCK); + fcntl(server_fd, F_SETFD, FD_CLOEXEC); QString location = ident; location = QDir::cleanPath(QDir::tempPath()); @@ -929,11 +932,12 @@ int doStart(const QString &location) { delete w_inotify; return -1; } - if (fcntl(socketfd, F_SETFL, flags | O_NONBLOCK | O_CLOEXEC)) { + if (fcntl(socketfd, F_SETFL, flags | O_NONBLOCK)) { qWarning("fcntl(F_SETFL) failed: %s", ::strerror(errno)); delete w_inotify; return -1; } + fcntl(socketfd, F_SETFD, FD_CLOEXEC); struct sockaddr_un name; name.sun_family = PF_UNIX; @@ -998,11 +1002,8 @@ int doStart(const QString &location) { return socketfd; } - flags = fcntl(pipefd[0], F_GETFL, 0); - fcntl(pipefd[0], F_SETFL, flags|O_CLOEXEC); - flags = fcntl(pipefd[1], F_GETFL, 0); - fcntl(pipefd[1], F_SETFL, flags|O_CLOEXEC); - + fcntl(pipefd[0], F_SETFD, FD_CLOEXEC); + fcntl(pipefd[1], F_SETFD, FD_CLOEXEC); qint64 pid = 0; |