mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 12:35:28 +00:00
Free after getline(), even if fail, and catch eof() on el9
getline() allocates the space for the return value even if there is an error, so when it returns an error, we still have to free() it. In el9, when reading stdin we will get errno=0 returned (no error) when we hit the end of stdin. This behavior is different from el7/8. We don't want to throw an error here to avoid failing the test, since it doesn't. Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
@@ -385,7 +385,8 @@ static int parse_stdin_in_fn(int fd, struct scoutfs_ioctl_quota_rule *irules, si
|
||||
|
||||
ret = getline(&line, &size, stdin);
|
||||
if (ret < 0) {
|
||||
if (errno == ENOENT)
|
||||
free(line);
|
||||
if ((errno == ENOENT) || (errno == 0))
|
||||
return 0;
|
||||
|
||||
ret = -errno;
|
||||
|
||||
Reference in New Issue
Block a user