Skip to content

Commit

Permalink
librc: use return value of rc_getline for len instead of the buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
navi-desu committed Sep 17, 2024
1 parent 8cafbb7 commit ecf1d78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librc/librc.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ file_regex(const char *file, const char *regex)
{
FILE *fp;
char *line = NULL;
size_t len = 0;
size_t size = 0, len = 0;
regex_t re;
bool retval = true;
int result;
Expand All @@ -192,7 +192,7 @@ file_regex(const char *file, const char *regex)
return false;
}

while ((rc_getline(&line, &len, fp))) {
while ((len = rc_getline(&line, &size, fp))) {
char *str = line;
/* some /proc files have \0 separated content so we have to
loop through the 'line' */
Expand Down

0 comments on commit ecf1d78

Please sign in to comment.