summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-04-22 17:02:32 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-07-02 11:29:35 (GMT)
commit1d965e189dfd5c9977565ca0c20224806aa7473d (patch)
tree746c3f36069ce9b32a5e6fd25a0f818934a1654b /src/gui/painting/qpdf.cpp
parent557258e8f944f0003e9b71e5fe11fcb458db71d8 (diff)
downloadQt-1d965e189dfd5c9977565ca0c20224806aa7473d.zip
Qt-1d965e189dfd5c9977565ca0c20224806aa7473d.tar.gz
Qt-1d965e189dfd5c9977565ca0c20224806aa7473d.tar.bz2
Use the safe versions in these system calls I've just introduced.
Reviewed-By: ossi
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index a6ecd4e..178d519 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -48,6 +48,10 @@
#include "qprinterinfo.h"
#include <qnumeric.h>
+#ifdef Q_OS_UNIX
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
+#endif
+
QT_BEGIN_NAMESPACE
extern int qt_defaultDpi();
@@ -1647,7 +1651,7 @@ static void closeAllOpenFds()
#endif
// leave stdin/out/err untouched
while(--i > 2)
- ::close(i);
+ QT_CLOSE(i);
}
#endif
@@ -1681,7 +1685,7 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
if (!printerName.isEmpty())
pr = printerName;
int fds[2];
- if (pipe(fds) != 0) {
+ if (qt_safe_pipe(fds) != 0) {
qWarning("QPdfPrinter: Could not open pipe to print");
return false;
}
@@ -1700,9 +1704,9 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
(void)execlp("true", "true", (char *)0);
(void)execl("/bin/true", "true", (char *)0);
(void)execl("/usr/bin/true", "true", (char *)0);
- ::exit(0);
+ ::_exit(0);
}
- dup2(fds[0], 0);
+ qt_safe_dup2(fds[0], 0, 0);
closeAllOpenFds();
@@ -1769,14 +1773,14 @@ bool QPdfBaseEnginePrivate::openPrintDevice()
// wait for a second so the parent process (the
// child of the GUI process) has exited. then
// exit.
- ::close(0);
+ QT_CLOSE(0);
(void)::sleep(1);
- ::exit(0);
+ ::_exit(0);
}
// parent process
- ::close(fds[0]);
+ QT_CLOSE(fds[0]);
fd = fds[1];
- (void)::waitpid(pid, 0, 0);
+ (void)qt_safe_waitpid(pid, 0, 0);
if (fd < 0)
return false;