Browse Source

* source/files : strip newline

master
Alex 'AdUser' Z 3 years ago
parent
commit
1f4dd61788
  1. 3
      src/sources/files.c

3
src/sources/files.c

@ -107,6 +107,7 @@ file_rotated(const cfg_t *cfg, f2b_file_t *file) {
static bool
file_getline(f2b_file_t *file, char *buf, size_t bufsize) {
char *p;
assert(file != NULL);
assert(buf != NULL);
@ -114,6 +115,8 @@ file_getline(f2b_file_t *file, char *buf, size_t bufsize) {
clearerr(file->fd);
/* fread()+EOF set is implementation defined */
if (fgets(buf, bufsize, file->fd) != NULL) {
if ((p = strchr(buf, '\n')) != NULL)
*p = '\0'; /* strip newline(s) */
file->lines++;
return true;
}

Loading…
Cancel
Save