pasta: Check for zero d_reclen returned by getdents64() syscall
Seen on PPC with some older kernel versions: we seemingly have bytes left to read from the returned array of dirent structs, but d_reclen is zero: this, and all the subsequent entries, are not valid. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
64f7d81d9a
commit
34872fadec
1 changed files with 1 additions and 1 deletions
2
pasta.c
2
pasta.c
|
@ -63,7 +63,7 @@ loop:
|
||||||
struct dirent *dp = (struct dirent *)buf;
|
struct dirent *dp = (struct dirent *)buf;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
while (pos < n) {
|
while (dp->d_reclen && pos < n) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
Loading…
Reference in a new issue