From: Mark Wooding Date: Thu, 26 May 2016 08:26:09 +0000 (+0100) Subject: key/key-io.c: Produce valid key lines for empty keys. X-Git-Tag: 2.3.1~9 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/a1a5d097891abd6ac62d4af825a2507980a9f1a0 key/key-io.c: Produce valid key lines for empty keys. If a key contains only an empty tree of structures, then `key_write' returns an empty string, which breaks the whitespace-separated field structure of the output key line. Notice this and insert an empty structure by hand as an unpleasant bodge. The resulting key is still highly anomalous. In particular, it doesn't match any filter, because structure nodes don't have flags. I don't know what to do about this. --- diff --git a/key/key-io.c b/key/key-io.c index b2dc9189..c79c8e06 100644 --- a/key/key-io.c +++ b/key/key-io.c @@ -352,7 +352,7 @@ int key_extract(key_file *f, key *k, FILE *fp, const key_filter *kf) key_fulltag(k, &d); DPUTC(&d, ' '); - key_write(k->k, &d, kf); + if (!key_write(k->k, &d, kf)) dstr_puts(&d, "struct:[]"); DPUTC(&d, ' '); dstr_write(&d, fp); DRESET(&d);