VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / arch / mips / kernel / linux32.c
index 8364744..a53f315 100644 (file)
@@ -477,6 +477,9 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
                goto out;
        if (pos < 0)
                goto out;
+       ret = -ESPIPE;
+       if (!(file->f_mode & FMODE_PREAD))
+               goto out;
        ret = read(file, buf, count, &pos);
        if (ret > 0)
                dnotify_parent(file->f_dentry, DN_ACCESS);
@@ -511,6 +514,10 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
        if (pos < 0)
                goto out;
 
+       ret = -ESPIPE;
+       if (!(file->f_mode & FMODE_PWRITE))
+               goto out;
+
        ret = write(file, buf, count, &pos);
        if (ret > 0)
                dnotify_parent(file->f_dentry, DN_MODIFY);