libcglue fix: d_type field uninitialized in getdents

This commit is contained in:
kub
2023-11-22 23:34:49 +01:00
parent 2f723c3b82
commit 55aa864574

View File

@@ -487,6 +487,12 @@ int getdents(int fd, void *dd_buf, int count)
strncpy(dirp->d_name, sceiode.d_name, MAXNAMLEN); strncpy(dirp->d_name, sceiode.d_name, MAXNAMLEN);
dirp->d_name[MAXNAMLEN] = 0; dirp->d_name[MAXNAMLEN] = 0;
dirp->d_reclen = count; dirp->d_reclen = count;
switch (sceiode.d_stat.st_mode & FIO_S_IFMT) {
case FIO_S_IFLNK: dirp->d_type = DT_LNK; break;
case FIO_S_IFDIR: dirp->d_type = DT_DIR; break;
case FIO_S_IFREG: dirp->d_type = DT_REG; break;
default: dirp->d_type = DT_UNKNOWN; break;
}
return read; return read;
} }