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.
#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>
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(".");