From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
This patch fixes the error number when invalid file is passed (neother
S_ISBLK nor S_ISREG is true). We should return -EINVAL.
if (!(file->f_mode & FMODE_WRITE))
lo_flags |= LO_FLAGS_READ_ONLY;
+ error = -EINVAL;
if (S_ISBLK(inode->i_mode)) {
lo_device = I_BDEV(inode);
if (lo_device == bdev) {
* If we can't read - sorry. If we only can't write - well,
* it's going to be read-only.
*/
- error = -EINVAL;
if (!inode->i_fop->sendfile)
goto out_putf;
lo_blocksize = inode->i_blksize;
lo_flags |= LO_FLAGS_DO_BMAP;
- error = 0;
} else
goto out_putf;