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.4.0~54 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/011174f4c9c5c7abffb14060dddd6311ca417391 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 df7cd53f..843f81d8 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);