From b7f0e3f6c0e748465efd79482dfb56d29caedc1b Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 3 Nov 2017 21:27:07 +0100 Subject: run: save errno before calling other functions --- xe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xe.c b/xe.c index 728102c..5f93856 100644 --- a/xe.c +++ b/xe.c @@ -262,8 +262,9 @@ run() } } execvp(args[0], args); + int status = (errno == ENOENT ? 127 : 126); fprintf(stderr, "xe: %s: %s\n", args[0], strerror(errno)); - exit(errno == ENOENT ? 127 : 126); + exit(status); } if (pid < 0) exit(126); -- cgit 1.4.1