diff options
author | Frerich Raabe <raabe@froglogic.com> | 2016-03-02 23:11:02 +0100 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-05-03 07:41:28 +0000 |
commit | 81776586ed1f52fc58476c27bb14a850453213c2 (patch) | |
tree | 3b0caf4fc5c6fca91da4d5a1a245769f4ab74c9b /src | |
parent | b5480f253ac64ad66e8f8150d7dd7896fc6258e0 (diff) |
Fixed detecting problems while launching sudo
The installer would always consider the exit status of the sudo process,
but if executing sudo itself fails (e.g. because the file does not
exist, or because of insufficient permissions), a success exit status
(zero) was returned.
Fix this by rather returning the (negative) errno value in case anything
goes wrong with execve.
Change-Id: Iac5051e998982c6a31fa49cb6f4290cf66050c44
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/adminauthorization_x11.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libs/installer/adminauthorization_x11.cpp b/src/libs/installer/adminauthorization_x11.cpp index 3f8702eac..7c546c0f2 100644 --- a/src/libs/installer/adminauthorization_x11.cpp +++ b/src/libs/installer/adminauthorization_x11.cpp @@ -269,8 +269,10 @@ bool AdminAuthorization::execute(QWidget *parent, const QString &program, const ::unsetenv("LANG"); ::unsetenv("LC_ALL"); - ::execv(SU_COMMAND, argp); - _exit(0); + int exitStatus = 0; + if (::execv(SU_COMMAND, argp) == -1) + exitStatus = -errno; + _exit(exitStatus); return false; } } |