]> git.ipfire.org Git - thirdparty/coreutils.git/commit
who: avoid new warning from upcoming gcc-7
authorJim Meyering <meyering@fb.com>
Thu, 22 Sep 2016 14:56:15 +0000 (07:56 -0700)
committerJim Meyering <meyering@fb.com>
Thu, 22 Sep 2016 17:17:07 +0000 (10:17 -0700)
commiteb406b2caf4d6307d7f86f38da4d6029a6b83961
treed26a1e3230057fd8d55a696a7deef6bccd8a1bc6
parent1db94ee969b984bbd00b97c6abbe2f69db8e0000
who: avoid new warning from upcoming gcc-7

* 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.
src/who.c