clean up FORTIFY_SOURCE handling.
Avoid duplicating huge chunks of code.
Change-Id: Id6145cdfce781c5ffba2abaaa79681d25a7ab28f
diff --git a/libc/bionic/__fgets_chk.cpp b/libc/bionic/__fgets_chk.cpp
index 780cf16..6ae97cc 100644
--- a/libc/bionic/__fgets_chk.cpp
+++ b/libc/bionic/__fgets_chk.cpp
@@ -45,15 +45,11 @@
FILE *stream, size_t dest_len_from_compiler)
{
if (supplied_size < 0) {
- __libc_android_log_print(ANDROID_LOG_FATAL, "libc",
- "*** fgets buffer size less than 0 ***\n");
- abort();
+ __fortify_chk_fail("fgets buffer size less than 0", 0);
}
if (((size_t) supplied_size) > dest_len_from_compiler) {
- __libc_android_log_print(ANDROID_LOG_FATAL, "libc",
- "*** fgets buffer overflow detected ***\n");
- abort();
+ __fortify_chk_fail("fgets buffer overflow", 0);
}
return fgets(dest, supplied_size, stream);