ujail-console: add missing error handling discovered by coverity
[project/procd.git] / sysupgrade.c
index a5bad9a8e4264e3cfc1caf4f0a2a4edec70043bb..fc588b0248353137d4b81fce130d2d35d8dfa710 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 
+#define _GNU_SOURCE
 #include "watchdog.h"
 #include "sysupgrade.h"
 
@@ -24,7 +25,8 @@
 
 #include <libubox/blobmsg.h>
 
-void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command,
+void sysupgrade_exec_upgraded(const char *prefix, char *path,
+                             const char *backup, char *command,
                              struct blob_attr *options)
 {
        char *wdt_fd = watchdog_fd();
@@ -47,6 +49,9 @@ void sysupgrade_exec_upgraded(const char *prefix, char *path, char *command,
                setenv("WDTFD", wdt_fd, 1);
        }
 
+       if (backup)
+               setenv("UPGRADE_BACKUP", backup, 1);
+
        blobmsg_for_each_attr(option, options, rem) {
                const char *prefix = "UPGRADE_OPT_";
                char value[11];