[Linux-parport] [PATCH] priority fix in pt_open(); in drivers/block/paride/pt.c
Roel Kluin
12o3l at tiscali.nl
Thu Nov 15 17:38:35 EST 2007
This patch wasn't tested.
from drivers/block/paride/pt.c:203
#define PT_MEDIA 1
#define PT_WRITE_OK 2
and as a part of struct pt_unit (below defines)
int flags;
(tape is a pt_unit*)
--
'!' has a higher priority than '&', so as is this doesn't test bits, but rather
evaluates to false when bitanding with PT_WRITE_OK, or - when bitanding with
PT_MEDIA - to false for any non-zero tape->flags.
Signed-off-by: Roel Kluin <12o3l at tiscali.nl>
---
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67e..37079d9 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -660,11 +660,11 @@ static int pt_open(struct inode *inode, struct file *file)
pt_identify(tape);
err = -ENODEV;
- if (!tape->flags & PT_MEDIA)
+ if (!(tape->flags & PT_MEDIA))
goto out;
err = -EROFS;
- if ((!tape->flags & PT_WRITE_OK) && (file->f_mode & 2))
+ if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
goto out;
if (!(iminor(inode) & 128))
More information about the Linux-parport
mailing list