X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=sysupgrade.c;h=07e33f752d0c3be57962771cdf42f02576d42e7f;hp=30f1836135c9187be1fcb626a51e50faeadc514a;hb=17026f4683b2a99085779e6bec3a2e67479089e0;hpb=63789e51ed913394c6bd4ac34e40ed0c8fcccccf diff --git a/sysupgrade.c b/sysupgrade.c index 30f1836..07e33f7 100644 --- a/sysupgrade.c +++ b/sysupgrade.c @@ -26,8 +26,10 @@ void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command) { char *wdt_fd = watchdog_fd(); char *argv[] = { "/sbin/upgraded", NULL, NULL, NULL}; + int ret; - if (chroot(prefix)) { + ret = chroot(prefix); + if (ret < 0) { fprintf(stderr, "Failed to chroot for upgraded exec.\n"); return; } @@ -45,5 +47,9 @@ void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command) fprintf(stderr, "Failed to exec upgraded.\n"); unsetenv("WDTFD"); watchdog_set_cloexec(true); - chroot("."); + ret = chroot("."); + if (ret < 0) { + fprintf(stderr, "Failed to reset chroot, exiting.\n"); + exit(EXIT_FAILURE); + } }