< prev index next >

test/hotspot/gtest/logging/logTestUtils.inline.hpp

Print this page
rev 50967 : 8206977: Minor improvements of runtime code.

@@ -93,10 +93,11 @@
 static inline char* read_line(FILE* fp) {
   assert(fp != NULL, "invalid fp");
   int buflen = 512;
   char* buf = NEW_RESOURCE_ARRAY(char, buflen);
   long pos = ftell(fp);
+  if (pos < 0) return NULL;
 
   char* ret = fgets(buf, buflen, fp);
   while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) {
     // retry with a larger buffer
     buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2);
< prev index next >