The out_line doesn't need to be zero terminated, so print it not with %s

but with a %-8.8s instead. this prevents funny output, if the out_line
contains a long hostname that is larger than 8 chars.
This commit is contained in:
Andreas Schulz 1994-12-26 17:29:03 +00:00
parent 61233bdc2e
commit 9066320224
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5235

View File

@ -144,7 +144,7 @@ main(argc, argv)
mp = myutmp;
for (i = 0; i < nusers; i++) {
char buf[BUFSIZ];
(void)sprintf(buf, "%s:%s", mp->myhost, mp->myutmp.out_line);
(void)sprintf(buf, "%s:%-8.8s", mp->myhost, mp->myutmp.out_line);
printf("%-8.8s %-*s %.12s",
mp->myutmp.out_name,
width,