summaryrefslogtreecommitdiff
path: root/Libraries/LibC/unistd.cpp
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-05-15 12:08:39 +0300
committerAndreas Kling <kling@serenityos.org>2020-05-15 11:43:58 +0200
commit888329233bb95db64555296d867f3507b40fedd1 (patch)
tree6ed741191b54a0fdaa6e5dd5d64c281a9483baeb /Libraries/LibC/unistd.cpp
parent752617cbb2021aa52a9b822f7df17464a5f38fa5 (diff)
downloadserenity-888329233bb95db64555296d867f3507b40fedd1.zip
LibC: Fix execvp() errno
Of course, using dbg() in the middle will change errno (most likely, reset it to zero).
Diffstat (limited to 'Libraries/LibC/unistd.cpp')
-rw-r--r--Libraries/LibC/unistd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp
index 03c44bd060..da52fa5fd4 100644
--- a/Libraries/LibC/unistd.cpp
+++ b/Libraries/LibC/unistd.cpp
@@ -135,7 +135,9 @@ int execvpe(const char* filename, char* const argv[], char* const envp[])
int execvp(const char* filename, char* const argv[])
{
int rc = execvpe(filename, argv, environ);
- dbg() << "execvp() about to return " << rc << " with errno=" << errno;
+ int saved_errno = errno;
+ dbg() << "execvp() about to return " << rc << " with errno=" << saved_errno;
+ errno = saved_errno;
return rc;
}