If reading into buffer, correct the stored file size at EOF, we don't
authornicm <nicm@openbsd.org>
Fri, 29 May 2015 11:03:37 +0000 (11:03 +0000)
committernicm <nicm@openbsd.org>
Fri, 29 May 2015 11:03:37 +0000 (11:03 +0000)
want to look at any garbage that might already be in the buffer after
that. From Sebastien Marie.

usr.bin/file/file.c

index 961b771..7402fa0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.40 2015/05/29 07:30:28 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.41 2015/05/29 11:03:37 nicm Exp $ */
 
 /*
  * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -395,7 +395,7 @@ fill_buffer(struct input_file *inf)
                next = (char *)next + got;
                left -= got;
        }
-
+       inf->size -= left;
        return buffer;
 }