Files
Zhang Ning ca925a740a fs/file_table: split fget_light
due to systemd updated, sun8i kernel doesn't compact to new systemd.
after check systemd code, it return -EBADF in below code:

https://github.com/systemd/systemd/blob/master/src/basic/fs-util.c#L804-L815

fstat on path fds (open with O_PATH).

after check sun8i kernel code, in fstat path, fget_light rectly returns
NULL on path fds (file->f_mode & FMODE_PATH).

on mainline kernel, fget_light is wraper function of __fget_light.
on fstat path, it uses __fget_light, doesn't check FMODE_PATH.

so follow mainline kernel, change the behavior of sun8i kernel.

test case:

int main(int argc, char **argv)
{
    int fd;
    struct stat previous_stat;

    fd =  open("/", O_CLOEXEC|O_NOFOLLOW|O_PATH);
    if (fd < 0) {
        printf("%d, %s\n", __LINE__,  strerror(errno));
         return -errno;
    }

    if(fstat(fd, &previous_stat) < 0) {

        printf("%d, %s\n", __LINE__, strerror(errno));
        return -errno;
    }
}

expect no error.

Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
2019-01-27 18:48:12 +08:00
..
2017-04-29 11:16:49 +03:00
2017-04-29 11:16:49 +03:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00
2019-01-27 18:48:12 +08:00
2016-04-12 12:21:19 +02:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00
2016-04-12 12:21:19 +02:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00
2016-04-12 12:21:19 +02:00
2016-04-12 12:21:19 +02:00
2017-04-29 11:16:49 +03:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00
2016-04-12 12:21:19 +02:00
2017-04-29 11:16:49 +03:00
2016-04-12 12:21:19 +02:00