From f8164fb647a8e7947cfde137ddd9517b2fab51c4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 18 Aug 2015 16:20:48 +0100 Subject: 36227: attempt to fix metafication problem with ztrftime. fmt is treated as metafied on entry; use returned length to ensure we metafy or output the correct length if there are embedded nulls. --- Src/builtin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index 4a97a3163..572a0dd68 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1783,9 +1783,12 @@ fclist(FILE *f, Options ops, zlong first, zlong last, command, if required */ if (tdfmt != NULL) { struct tm *ltm; + int len; ltm = localtime(&ent->stim); - if (ztrftime(timebuf, 256, tdfmt, ltm, 0L)) - fprintf(f, "%s ", timebuf); + if ((len = ztrftime(timebuf, 256, tdfmt, ltm, 0L)) >= 0) { + fwrite(timebuf, 1, len, f); + fprintf(f, " "); + } } /* display the time taken by the command, if required */ if (OPT_ISSET(ops,'D')) { -- cgit 1.4.1