return -1;
case 0:
- if (execvp(usign_argv[0], (char *const *)usign_argv))
- return -1;
-
- break;
+ execvp(usign_argv[0], (char *const *)usign_argv);
+ if (!quiet)
+ perror("Failed to execute usign");
+ _exit(1);
default:
waitpid(pid, &status, 0);
* call usign -F ... and set fingerprint returned
* return WEXITSTATUS or -1 if fork or execv fails
*/
-static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckeyfile, const char *sigfile) {
+static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckeyfile, const char *sigfile, bool quiet) {
int fds[2];
pid_t pid;
int status;
close(fds[0]);
close(fds[1]);
- if (execvp(usign_argv[0], (char *const *)usign_argv))
- return -1;
-
- break;
+ execvp(usign_argv[0], (char *const *)usign_argv);
+ if (!quiet)
+ perror("Failed to execute usign");
+ _exit(1);
default:
waitpid(pid, &status, 0);
/*
* call usign -F -p ...
*/
-int usign_f_pubkey(char *fingerprint, const char *pubkeyfile) {
- return usign_f(fingerprint, pubkeyfile, NULL, NULL);
+int usign_f_pubkey(char *fingerprint, const char *pubkeyfile, bool quiet) {
+ return usign_f(fingerprint, pubkeyfile, NULL, NULL, quiet);
}
/*
* call usign -F -s ...
*/
-int usign_f_seckey(char *fingerprint, const char *seckeyfile) {
- return usign_f(fingerprint, NULL, seckeyfile, NULL);
+int usign_f_seckey(char *fingerprint, const char *seckeyfile, bool quiet) {
+ return usign_f(fingerprint, NULL, seckeyfile, NULL, quiet);
}
/*
* call usign -F -x ...
*/
-int usign_f_sig(char *fingerprint, const char *sigfile) {
- return usign_f(fingerprint, NULL, NULL, sigfile);
+int usign_f_sig(char *fingerprint, const char *sigfile, bool quiet) {
+ return usign_f(fingerprint, NULL, NULL, sigfile, quiet);
}
unsigned int usign_argc = 0;
char fingerprint[17];
- if (usign_f_sig(fingerprint, sigfile)) {
+ if (usign_f_sig(fingerprint, sigfile, quiet)) {
if (!quiet)
fprintf(stderr, "cannot get signing key fingerprint\n");
return 1;
return -1;
case 0:
- if (execvp(usign_argv[0], (char *const *)usign_argv))
- return -1;
-
- break;
+ execvp(usign_argv[0], (char *const *)usign_argv);
+ if (!quiet)
+ perror("Failed to execute usign");
+ _exit(1);
default:
waitpid(pid, &status, 0);
#ifndef _USIGN_H
#define _USIGN_H
+#include <stdbool.h>
+
/**
* Verify
*
*
* calls: usign -F ...
*/
-int usign_f_pubkey(char *fingerprint, const char *pubkeyfile);
+int usign_f_pubkey(char *fingerprint, const char *pubkeyfile, bool quiet);
-int usign_f_seckey(char *fingerprint, const char *seckeyfile);
+int usign_f_seckey(char *fingerprint, const char *seckeyfile, bool quiet);
-int usign_f_sig(char *fingerprint, const char *sigfile);
+int usign_f_sig(char *fingerprint, const char *sigfile, bool quiet);
/**
* custom extension to check for revokers