aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-02-09 15:41:35 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-02-09 15:42:21 +0100
commit9054786947b2f6b82078f6e5f965c3b0b629c880 (patch)
tree173e82157d5a61d61dcf70d5358fa2fe79108be4
parent6101bd9564d6334dea7c0de778536e3fe1a5e9b9 (diff)
downloadnx-libs-9054786947b2f6b82078f6e5f965c3b0b629c880.tar.gz
nx-libs-9054786947b2f6b82078f6e5f965c3b0b629c880.tar.bz2
nx-libs-9054786947b2f6b82078f6e5f965c3b0b629c880.zip
workaround for Mac OS X 10.5 (051_nxcomp_macos105-fdisset.full+lite.patch(
The Mac OS X 10.5 SDK requires the second argument of FD_ISSET to be writeable, although it does only access the data. Given that we have a const pointer for a const struct, copy and pass that. . Note that this is merely a workaround for OS X 10.5, as 10.6 and later define the second argument of FD_ISSET as const struct const *foo, too. . It is safe, as data is accessed read-only by FD_ISSET, even on 10.5.
-rw-r--r--debian/patches/051_nxcomp_macos105-fdisset.full+lite.patch82
-rw-r--r--debian/patches/series1
-rw-r--r--nxcomp/Agent.h28
3 files changed, 20 insertions, 91 deletions
diff --git a/debian/patches/051_nxcomp_macos105-fdisset.full+lite.patch b/debian/patches/051_nxcomp_macos105-fdisset.full+lite.patch
deleted file mode 100644
index 6b78a6bc2..000000000
--- a/debian/patches/051_nxcomp_macos105-fdisset.full+lite.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-Description: workaround for Mac OS X 10.5
- The Mac OS X 10.5 SDK requires the second argument of FD_ISSET to be
- writeable, although it does only access the data. Given that we have a
- const pointer for a const struct, copy and pass that.
- .
- Note that this is merely a workaround for OS X 10.5, as 10.6 and later
- define the second argument of FD_ISSET as const struct const *foo, too.
- .
- It is safe, as data is accessed read-only by FD_ISSET, even on 10.5.
-Forward: pending
-Author: Mihai Moldovan <ionic@ionic.de>
----
- nxcomp/Agent.h | 28 ++++++++++++++++++++--------
- 1 files changed, 20 insertions(+), 8 deletions(-)
-
---- a/nxcomp/Agent.h
-+++ b/nxcomp/Agent.h
-@@ -149,30 +149,38 @@
-
- int remoteCanRead(const fd_set * const readSet)
- {
-+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
-+ // It's safe though, as FD_ISSET does not operate on it.
-+ fd_set readWorkSet = *readSet;
-+
- #if defined(TEST) || defined(INFO)
- *logofs << "Agent: remoteCanRead() is " <<
-- (FD_ISSET(remoteFd_, readSet) && transport_ -> dequeuable() != 0)
-- << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, readSet)
-+ (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0)
-+ << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet)
- << " and dequeuable " << transport_ -> dequeuable()
- << ".\n" << logofs_flush;
- #endif
-
-- return (FD_ISSET(remoteFd_, readSet) &&
-+ return (FD_ISSET(remoteFd_, &readWorkSet) &&
- transport_ -> dequeuable() != 0);
- }
-
- int remoteCanWrite(const fd_set * const writeSet)
- {
-+ // OS X 10.5 requires the second argument to be non-const, so copy writeSet.
-+ // It's safe though, as FD_ISSET does not operate on it.
-+ fd_set writeWorkSet = *writeSet;
-+
- #if defined(TEST) || defined(INFO)
- *logofs << "Agent: remoteCanWrite() is " <<
-- (FD_ISSET(remoteFd_, writeSet) && transport_ ->
-+ (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ ->
- queuable() != 0 && canRead_ == 1) << " with FD_ISSET() "
-- << (int) FD_ISSET(remoteFd_, writeSet) << " queueable "
-+ << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable "
- << transport_ -> queuable() << " channel can read "
- << canRead_ << ".\n" << logofs_flush;
- #endif
-
-- return (FD_ISSET(remoteFd_, writeSet) &&
-+ return (FD_ISSET(remoteFd_, &writeWorkSet) &&
- transport_ -> queuable() != 0 &&
- canRead_ == 1);
- }
-@@ -203,13 +211,17 @@
-
- int proxyCanRead(const fd_set * const readSet)
- {
-+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
-+ // It's safe though, as FD_ISSET does not operate on it.
-+ fd_set readWorkSet = *readSet;
-+
- #if defined(TEST) || defined(INFO)
- *logofs << "Agent: proxyCanRead() is "
-- << ((int) FD_ISSET(proxy -> getFd(), readSet)
-+ << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)
- << ".\n" << logofs_flush;
- #endif
-
-- return (FD_ISSET(proxy -> getFd(), readSet));
-+ return (FD_ISSET(proxy -> getFd(), &readWorkSet));
- }
-
- int enqueueData(const char *data, const int size) const
diff --git a/debian/patches/series b/debian/patches/series
index 2c9811e29..214bf6a69 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-051_nxcomp_macos105-fdisset.full+lite.patch
052_nxcomp_macos10-nxauth-location.full+lite.patch
053_nx-X11_no-xcomp1-install-target.full.patch
054_nx-X11_ppc64-ftbfs.full.patch
diff --git a/nxcomp/Agent.h b/nxcomp/Agent.h
index fac5acd43..ded344d84 100644
--- a/nxcomp/Agent.h
+++ b/nxcomp/Agent.h
@@ -149,30 +149,38 @@ class Agent
int remoteCanRead(const fd_set * const readSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set readWorkSet = *readSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanRead() is " <<
- (FD_ISSET(remoteFd_, readSet) && transport_ -> dequeuable() != 0)
- << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, readSet)
+ (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0)
+ << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet)
<< " and dequeuable " << transport_ -> dequeuable()
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, readSet) &&
+ return (FD_ISSET(remoteFd_, &readWorkSet) &&
transport_ -> dequeuable() != 0);
}
int remoteCanWrite(const fd_set * const writeSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy writeSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set writeWorkSet = *writeSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanWrite() is " <<
- (FD_ISSET(remoteFd_, writeSet) && transport_ ->
+ (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ ->
queuable() != 0 && canRead_ == 1) << " with FD_ISSET() "
- << (int) FD_ISSET(remoteFd_, writeSet) << " queueable "
+ << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable "
<< transport_ -> queuable() << " channel can read "
<< canRead_ << ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, writeSet) &&
+ return (FD_ISSET(remoteFd_, &writeWorkSet) &&
transport_ -> queuable() != 0 &&
canRead_ == 1);
}
@@ -203,13 +211,17 @@ class Agent
int proxyCanRead(const fd_set * const readSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set readWorkSet = *readSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: proxyCanRead() is "
- << ((int) FD_ISSET(proxy -> getFd(), readSet)
+ << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(proxy -> getFd(), readSet));
+ return (FD_ISSET(proxy -> getFd(), &readWorkSet));
}
int enqueueData(const char *data, const int size) const