diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 99334521909beef8ba2f1d36c363392871d1fc42..b476d84feda78992cd3f71983b3110aee3872fd9 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -160,11 +160,19 @@ char *read_text_file(const char *filename) char *get_line(char **stringp) { + char *orig = *stringp, *next; + /* do not return the unwanted extra line at EOF */ - if (*stringp && **stringp == '\0') + if (!orig || *orig == '\0') return NULL; - return strsep(stringp, "\n"); + next = strchr(orig, '\n'); + if (next) + *next++ = '\0'; + + *stringp = next; + + return orig; } /* A list of all modules we processed */