From: Matthias Schiffer Date: Sat, 16 May 2020 11:26:55 +0000 (+0200) Subject: stdout/stderr improvements X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fdff10852326122134a60911a3b3c7c2aeab5723;p=oweals%2Fucert.git stdout/stderr improvements - Print error messages to stderr - fprintf(stdout, ...) is just printf(...) Signed-off-by: Matthias Schiffer --- diff --git a/ucert.c b/ucert.c index d822199..2ea9399 100644 --- a/ucert.c +++ b/ucert.c @@ -381,7 +381,7 @@ static void cert_dump_blob(struct blob_attr *cert[CERT_ATTR_MAX]) { switch(cert_policy[i].type) { case BLOB_ATTR_BINARY: - fprintf(stdout, "signature:\n---\n%s---\n", (char *) blob_data(v)); + printf("signature:\n---\n%s---\n", (char *) blob_data(v)); break; case BLOB_ATTR_NESTED: json = blobmsg_format_json_indent(blob_data(v), false, 0); @@ -389,7 +389,7 @@ static void cert_dump_blob(struct blob_attr *cert[CERT_ATTR_MAX]) { DPRINTF("cannot parse payload\n"); continue; } - fprintf(stdout, "payload:\n---\n%s\n---\n", json); + printf("payload:\n---\n%s\n---\n", json); free(json); break; } @@ -408,7 +408,7 @@ static int cert_dump(const char *certfile) { } list_for_each_entry(cobj, &certchain, list) { - fprintf(stdout, "=== CHAIN ELEMENT %02u ===\n", ++count); + printf("=== CHAIN ELEMENT %02u ===\n", ++count); cert_dump_blob(cobj->cert); } diff --git a/usign-exec.c b/usign-exec.c index 85e5f95..7f61065 100644 --- a/usign-exec.c +++ b/usign-exec.c @@ -209,13 +209,13 @@ int usign_v(const char *msgfile, const char *pubkeyfile, if (usign_f_sig(fingerprint, sigfile)) { if (!quiet) - fprintf(stdout, "cannot get signing key fingerprint\n"); + fprintf(stderr, "cannot get signing key fingerprint\n"); return 1; } if (pubkeydir && _usign_key_is_revoked(fingerprint, pubkeydir)) { if (!quiet) - fprintf(stdout, "key %s has been revoked!\n", fingerprint); + fprintf(stderr, "key %s has been revoked!\n", fingerprint); return 1; } usign_argv[usign_argc++] = USIGN_EXEC;