From a50c5d6674705d567e92a617827d808d75a912ba Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 28 Oct 2017 17:13:52 -0600 Subject: [PATCH] fs/procfs: Restore a necessary chagne that was lost with commit 07f441eecb5dd4f25a9a1f48f7c4e8f73bf6e41e --- fs/procfs/fs_procfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index d964d0f8ff..07aaec449b 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -795,7 +795,13 @@ static int procfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) strncpy(dir->fd_dir.d_name, name, level0->lastlen); dir->fd_dir.d_name[level0->lastlen] = '\0'; - if (entry->type == PROCFS_DIR_TYPE) + /* If the entry is a directory type OR if the reported name is + * only a sub-string of the entry (meaning that it contains + * '/'), then report this entry as a directory. + */ + + if (entry->type == PROCFS_DIR_TYPE || + level0->lastlen != strlen(name)) { dir->fd_dir.d_type = DTYPE_DIRECTORY; }