summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2022-01-17 20:43:01 +0100
committerPino Toscano <toscano.pino@tiscali.it>2022-01-18 06:42:51 +0100
commit13a11f1c3526112eaf28943185fadc14523fd496 (patch)
tree9834e6eebfff57b4f4beb64b2370a8e28de5f3f4 /src/corelib/io
parent86b346823e114ac0b6b1c2ab6065ce53b1393de0 (diff)
QProcess/Unix: fallback on _POSIX_PIPE_BUF w/ missing PIPE_BUF
PIPE_BUF is optional in POSIX, e.g. "where the corresponding value is equal to or greater than the stated minimum, but where the value can vary depending on the file to which it is applied." [1] GNU/Hurd does not provide PIPE_BUF, so fallback to its minimum acceptable value, that is _POSIX_PIPE_BUF. [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html Also, explicitly include <limits.h> in this file, to make sure PIPE_BUF or _POSIX_PIPE_BUF are available without relying on other headers to pull <limits.h>. Change-Id: Ifae964db81841e1d31fc09e73b45594af9a326d1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess_unix.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index bf19fc2183..91005b0b67 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -69,6 +69,7 @@
#endif
#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
@@ -935,7 +936,11 @@ bool QProcessPrivate::startDetached(qint64 *pid)
{
QByteArray encodedWorkingDirectory = QFile::encodeName(workingDirectory);
+#ifdef PIPE_BUF
static_assert(PIPE_BUF >= sizeof(ChildError));
+#else
+ static_assert(_POSIX_PIPE_BUF >= sizeof(ChildError));
+#endif
ChildError childStatus = { 0, {} };
AutoPipe startedPipe, pidPipe;