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
diff --git a/libc/bionic/gethostname.cpp b/libc/bionic/gethostname.cpp
index 962fea1..b780a2f 100644
--- a/libc/bionic/gethostname.cpp
+++ b/libc/bionic/gethostname.cpp
@@ -32,10 +32,8 @@
#include <unistd.h>
int gethostname(char* buf, size_t n) {
- struct utsname name;
- if (uname(&name) == -1) {
- return -1;
- }
+ utsname name = {};
+ uname(&name);
size_t name_length = static_cast<size_t>(strlen(name.nodename) + 1);
if (name_length > n) {