Browse Source

fsmonitor: fix incorrect buffer size when printing version number

This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version.  It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ben Peart 7 years ago committed by Junio C Hamano
parent
commit
d8579accfa
  1. 2
      fsmonitor.c

2
fsmonitor.c

@ -114,7 +114,7 @@ static int query_fsmonitor(int version, uint64_t last_update, struct strbuf *que
if (!(argv[0] = core_fsmonitor)) if (!(argv[0] = core_fsmonitor))
return -1; return -1;


snprintf(ver, sizeof(version), "%d", version); snprintf(ver, sizeof(ver), "%d", version);
snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update); snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
argv[1] = ver; argv[1] = ver;
argv[2] = date; argv[2] = date;

Loading…
Cancel
Save