* src/who.c (idle_string): This function would fail to compile
with -Werror and today's built-from-git gcc due to this warning:
src/who.c: In function 'print_user':
src/who.c:201:36: error: may write format character ':' at offset 4 \
past the end of the destination [-Werror=format-length=]
sprintf (idle_hhmm, "%02d:%02d",
^~~~~
The fix is to use an assertion to inform gcc of the existing
invariant that guarantees the number of hours is less than 24.
#include <config.h>
#include <getopt.h>
#include <stdio.h>
+#include <assert.h>
#include <sys/types.h>
#include "system.h"
else
{
static char idle_hhmm[IDLESTR_LEN];
+ /* FIXME-in-2018: see if this assert is still required in order
+ to suppress gcc's unwarranted -Wformat-length= warning. */
+ assert (seconds_idle / (60 * 60) < 24);
sprintf (idle_hhmm, "%02d:%02d",
seconds_idle / (60 * 60),
(seconds_idle % (60 * 60)) / 60);