From 7cebf835f310650f67b254295a685918681656fc Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 12 Aug 2020 14:25:41 -0700 Subject: Various coverage improvements. Mostly from extra test cases, but also: * Move the fgets size < 0 assertion into fgets. * Use ELF aliases for strtoq/strtouq rather than duplicating code. * Don't check uname() succeeded, since it can't fail. Test: treehugger Change-Id: I2e6b3b88b0a3eb16bd68be68b9bc9f40d8043291 --- libc/stdio/stdio.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libc/stdio/stdio.cpp') diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp index afc2c4881..b8aced83b 100644 --- a/libc/stdio/stdio.cpp +++ b/libc/stdio/stdio.cpp @@ -773,10 +773,7 @@ char* fgets(char* buf, int n, FILE* fp) { // Returns first argument, or nullptr if no characters were read. // Does not return nullptr if n == 1. char* fgets_unlocked(char* buf, int n, FILE* fp) { - if (n <= 0) { - errno = EINVAL; - return nullptr; - } + if (n <= 0) __fortify_fatal("fgets: buffer size %d <= 0", n); _SET_ORIENTATION(fp, -1); -- cgit v1.2.3