libopkg: use xsystem() to spawn opkg-key
[oweals/opkg-lede.git] / libopkg / opkg_download.c
index f9e7e98386dbb5d2e45f08e9dd54a004ce0033e2..e9705065aa76e85c63f7c6eef3223638ce313415 100644 (file)
@@ -17,7 +17,6 @@
    General Public License for more details.
 */
 
-#include <sys/wait.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <libgen.h>
@@ -299,29 +298,10 @@ int opkg_prepare_url_for_install(const char *url, char **namep)
 int opkg_verify_file(char *text_file, char *sig_file)
 {
 #if defined HAVE_USIGN
-       int status = -1;
-       int pid;
+       const char *argv[] = { "/usr/sbin/opkg-key", "verify", sig_file,
+                              text_file, NULL };
 
-       if (conf->check_signature == 0)
-               return 0;
-
-       pid = fork();
-       if (pid < 0) {
-               opkg_perror(ERROR, "Failed to fork opkg-key process");
-               return -1;
-       }
-
-       if (!pid) {
-               execl("/usr/sbin/opkg-key", "opkg-key", "verify", sig_file,
-                     text_file, NULL);
-               exit(255);
-       }
-
-       waitpid(pid, &status, 0);
-       if (!WIFEXITED(status) || WEXITSTATUS(status))
-               return -1;
-
-       return 0;
+       return xsystem(argv) ? -1 : 0;
 #else
        /* mute `unused variable' warnings. */
        (void)sig_file;