General Public License for more details.
*/
-#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
#include <libgen.h>
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;