diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-01-20 03:11:15 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-20 03:11:15 -0800 |
| commit | f76fe2f64a622d02e7755c423db0c3cd4ba62589 (patch) | |
| tree | a12f3b3d5bc16522a0401c52ee0eb02107b8614c /drivers/block/loop.c | |
| parent | 56f4a65438dd5b2e91ba16f000ba3f1732076dba (diff) | |
[PATCH] loop: trivial error number fix
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.
Diffstat (limited to 'drivers/block/loop.c')
| -rw-r--r-- | drivers/block/loop.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index f815c2f9733e..34ce36c4447b 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -683,6 +683,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, 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) { @@ -698,7 +699,6 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, * 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; @@ -707,7 +707,6 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, lo_blocksize = inode->i_blksize; lo_flags |= LO_FLAGS_DO_BMAP; - error = 0; } else goto out_putf; |
