summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-07-16 17:41:15 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-07-20 16:07:46 +0000
commitdb2fc7843c031c450799269ad82f379d358f29a5 (patch)
tree229337d65ced61eb927d8ec14adcfae254f8e360 /src/corelib/io
parentee0fd8700724848e73c228d973bf72e246077d07 (diff)
QProcess: make setWorkingDirectory stop launch if the dir doesn't exist
[ChangeLog][QtCore][QProcess] Fixed a bug that caused QProcess to launch a child process on Unix even if the directory specified with setWorkingDirectory did not exist. Task-number: QTBUG-47271 Change-Id: Ib306f8f647014b399b87ffff13f195158b0e52f5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess_unix.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 4c3432d6b6..63480dfc6b 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -672,9 +672,9 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
qt_safe_close(childStartedPipe[0]);
// enter the working directory
- if (workingDir) {
- if (QT_CHDIR(workingDir) == -1)
- qWarning("QProcessPrivate::execChild() failed to chdir to %s", workingDir);
+ if (workingDir && QT_CHDIR(workingDir) == -1) {
+ // failed, stop the process
+ goto report_errno;
}
// this is a virtual call, and it base behavior is to do nothing.
@@ -703,6 +703,7 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv
}
// notify failure
+report_errno:
QString error = qt_error_string(errno);
#if defined (QPROCESS_DEBUG)
fprintf(stderr, "QProcessPrivate::execChild() failed (%s), notifying parent process\n", qPrintable(error));