allow append also on non-existing certfile
authorDaniel Golle <daniel@makrotopia.org>
Thu, 7 Jun 2018 13:16:41 +0000 (15:16 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 14 Jun 2018 16:51:22 +0000 (18:51 +0200)
Just in case someone just wants a single plain signature without any
chain.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This work was sponsored by WIO (wiowireless.com)

ucert.c

diff --git a/ucert.c b/ucert.c
index 4beb4995e02a94512dd4e973e56e4f96d642e57d..7be2f8f0691ad809f0f8851e3251c6c1a289ef3c 100644 (file)
--- a/ucert.c
+++ b/ucert.c
@@ -161,15 +161,9 @@ static int cert_append(const char *certfile, const char *sigfile) {
        FILE *fs;
        char filebuf[CERT_BUF_LEN];
        struct blob_buf sigbuf;
        FILE *fs;
        char filebuf[CERT_BUF_LEN];
        struct blob_buf sigbuf;
-       struct stat st;
        int len;
        int ret;
 
        int len;
        int ret;
 
-       if (stat(certfile, &st) != 0) {
-               fprintf(stderr, "certfile %s doesn't exist, can't append.\n", certfile);
-               return -1;
-       }
-
        fs = fopen(sigfile, "r");
        if (!fs)
                return 1;
        fs = fopen(sigfile, "r");
        if (!fs)
                return 1;
@@ -481,7 +475,7 @@ static int usage(const char *cmd)
        fprintf(stderr,
                "Usage: %s <command> <options>\n"
                "Commands:\n"
        fprintf(stderr,
                "Usage: %s <command> <options>\n"
                "Commands:\n"
-               "  -A:                  append (needs -c and -x)\n"
+               "  -A:                  append signature (needs -c and -x)\n"
                "  -D:                  dump\n"
                "  -I:                  issue cert and revoker (needs -c and -p and -s)\n"
                "  -R:                  process revoker certificate (needs -c)\n"
                "  -D:                  dump\n"
                "  -I:                  issue cert and revoker (needs -c and -p and -s)\n"
                "  -R:                  process revoker certificate (needs -c)\n"