From: Stijn Tintel Date: Tue, 8 Nov 2022 12:43:25 +0000 (+0200) Subject: sysupgrade: print errno on failure X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fheads%2Fstaging%2Fstintel%2Fsysupgrade;p=project%2Fprocd.git sysupgrade: print errno on failure 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. --- 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 +#include #include #include +#include #include #include @@ -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(".");