Skip to contentSkip to conversation

posix_fadvise bug (unexpected success on FIFO/pipe)

PATCH New Valentine Barshak 1 participant 1 message Dec 9, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 posix_fadvise bug (unexpected success on FIFO/pipe)

Hello all.
This patch adds a FIFO/pipe check to posix_fadvise system call.
If the specified file descriptor is pipe or FIFO, the system call returns ESPIPE error. Thank you.

mm/fadvise.c 2005-12-06 23:04:19.980711464 +0300 renamed from mm/fadvise.c 2005-10-10 22:54:29.000000000 +0400 +5 -0
@@ -37,6 +37,11 @@
        if (!file)
                return -EBADF;
 
+       if (S_ISFIFO(file->f_dentry->d_inode->i_mode)) {
+               ret = -ESPIPE;
+               goto out;
+       }
+
        mapping = file->f_mapping;
        if (!mapping || len < 0) {
                ret = -EINVAL;