Commit c07ac043 authored by Linus Torvalds's avatar Linus Torvalds

Add d_type information to legacy readdir system call

parent b3f4d558
...@@ -139,7 +139,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ...@@ -139,7 +139,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
{ {
struct linux_dirent __user * dirent; struct linux_dirent __user * dirent;
struct getdents_callback * buf = (struct getdents_callback *) __buf; struct getdents_callback * buf = (struct getdents_callback *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
buf->error = -EINVAL; /* only used if we fail.. */ buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count) if (reclen > buf->count)
...@@ -158,6 +158,8 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ...@@ -158,6 +158,8 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
goto efault; goto efault;
if (__put_user(0, dirent->d_name + namlen)) if (__put_user(0, dirent->d_name + namlen))
goto efault; goto efault;
if (__put_user(d_type, (char *) dirent + reclen - 1))
goto efault;
buf->previous = dirent; buf->previous = dirent;
dirent = (void *)dirent + reclen; dirent = (void *)dirent + reclen;
buf->current_dir = dirent; buf->current_dir = dirent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment