On Sun, Jul 02, 2017 at 12:26:19AM +0200, Ingo Schwarze wrote: > I don't see a need for two char * variables here, that's an artifact > of the typical fgetln(3) complications. Just > > char *line = NULL; > size_t linesize = 0; > ssize_t slen; > > while ((slen = getline(&line, &linesize, f)) != -1) { > if (line[slen - 1] == '\n') > /* etc. */ > } > free(line); > if (ferror(f)) > err(1, "%s", path); > > ought to suffice. > > Yours, > Ingo
Hmm, there's a Segmentation fault that I can't seems to narrow down with the change you suggest. That's odd..