Browse Source

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.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Stijn Tintel 1 year ago
parent
commit
039b88f753
1 changed files with 3 additions and 1 deletions
  1. 3 1
      sysupgrade.c

+ 3 - 1
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>
@@ -103,7 +105,7 @@ void sysupgrade_exec_upgraded(const char *prefix, char *path,
 	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(".");