summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-08-12 14:25:41 -0700
committerElliott Hughes <enh@google.com>2020-08-12 15:52:14 -0700
commit7cebf835f310650f67b254295a685918681656fc (patch)
treedaf485447fccb691750149c465b2c629adf6e305 /libc/stdio/stdio.cpp
parenta4110def5cec22306313a34fff64b5810c9b1792 (diff)
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
Diffstat (limited to 'libc/stdio/stdio.cpp')
-rw-r--r--libc/stdio/stdio.cpp5
1 files changed, 1 insertions, 4 deletions
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);