small style fixes
[oweals/busybox.git] / libbb / fgets_str.c
index 8f06fa59c3a22baf5ac06605b95db049a69d16b2..41370d1763591b1a29f8462417a096dd6b28553a 100644 (file)
@@ -44,12 +44,14 @@ char *fgets_str(FILE *file, const char *terminating_string)
 
                /* Check for terminating string */
                end_string_offset = idx - term_length;
-               if ((end_string_offset > 0) && (memcmp(&linebuf[end_string_offset], terminating_string, term_length) == 0)) {
+               if (end_string_offset > 0
+                && memcmp(&linebuf[end_string_offset], terminating_string, term_length) == 0
+               ) {
                        idx -= term_length;
                        break;
                }
        }
+       linebuf = xrealloc(linebuf, idx + 1);
        linebuf[idx] = '\0';
-       return(linebuf);
+       return linebuf;
 }
-