From 76a9a091cd0923be3f0d96148b765808c16e4d7f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 8 Nov 2022 14:43:25 +0200 Subject: [PATCH] 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. --- sysupgrade.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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("."); -- 2.30.2