Patch from Stefan Soucek <ssoucek@coactive.com> to
authorEric Andersen <andersen@codepoet.org>
Thu, 18 Oct 2001 03:20:41 +0000 (03:20 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 18 Oct 2001 03:20:41 +0000 (03:20 -0000)
ignore extra empty lines in fgets_str

libbb/fgets_str.c

index 33d8d00ccc3c2d37ab79e55f373e05e16a7e6011..7d41d72f1d63c4ada9e670f720b43167fb461dee 100644 (file)
@@ -55,7 +55,7 @@ char *fgets_str(FILE *file, const char *terminating_string)
                        break;
                }
        }
-       if (idx == 0) {
+       if (idx == 0 || linebuf[0] == '\n') {
                return NULL;
        }
        linebuf[idx] = '\0';