Skip to content

Commit

Permalink
strftime(%k will abort()
Browse files Browse the repository at this point in the history
Windows will abort strftime() for any unrecognised
format options, replaced with equivalent %H.

Easily reproduced with "zfs get all" if there is also
a snapshot.

Signed-off-by: Jorgen Lundman <lundman@lundman.net>
  • Loading branch information
lundman committed Oct 23, 2023
1 parent 260f628 commit 13b4945
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,12 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,

if (literal ||
localtime_r(&time, &t) == NULL ||
strftime(propbuf, proplen, "%a %b %e %k:%M:%S %Y",
strftime(propbuf, proplen,
#ifdef _WIN32
"%a %b %e %H:%M:%S %Y",
#else
"%a %b %e %k:%M:%S %Y",
#endif
&t) == 0)
(void) snprintf(propbuf, proplen, "%llu",
(u_longlong_t)val);
Expand Down

0 comments on commit 13b4945

Please sign in to comment.