summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Tintel <stijn@linux-ipv6.be>2022-11-08 14:43:25 +0200
committerStijn Tintel <stijn@linux-ipv6.be>2022-11-23 17:25:25 +0200
commit76a9a091cd0923be3f0d96148b765808c16e4d7f (patch)
tree9e3d43ee90fa054daaef68c11e883c103b244905
parent3849197ce7b58db65c660f432b1e8a75806a99a9 (diff)
downloadprocd-staging/stintel/sysupgrade.tar.gz
sysupgrade: print errno on failurestaging/stintel/sysupgrade
The error message "Failed to exec upgraded." is not very informative. Add errno to the message to make it more useful. Lacks SoB to avoid people merging/pushing this to master.
-rw-r--r--sysupgrade.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysupgrade.c b/sysupgrade.c
index fc588b0..e6c1c95 100644
--- a/sysupgrade.c
+++ b/sysupgrade.c
@@ -19,8 +19,10 @@
#include "sysupgrade.h"
#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <libubox/blobmsg.h>
@@ -100,10 +102,12 @@ void sysupgrade_exec_upgraded(const char *prefix, char *path,
free(name);
}
+ errno = 0;
+
execvp(argv[0], argv);
/* Cleanup on failure */
- fprintf(stderr, "Failed to exec upgraded.\n");
+ fprintf(stderr, "Failed to exec upgraded: %s\n", strerror(-errno));
unsetenv("WDTFD");
watchdog_set_cloexec(true);
ret = chroot(".");