Skip to contentSkip to conversation

dup203: fix error of not using O_ACCMODE

PATCH In review Peng Haitao 2 participants 2 messages Jan 19, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dup203: fix error of not using O_ACCMODE

Hi Garrett,

The file access mode is extracted from the return value of function fcntl() using the mask O_ACCMODE.

---
 testcases/kernel/syscalls/dup2/dup203.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/dup2/dup203.c +2 -2
index 51a3579..0df92b4 100644
@@ -170,7 +170,7 @@ int main(int ac, char **av)
 				    "return value of 0x0, got %#x", rval);
 				break;
 			}
-			if (((rval = fcntl(fd0, F_GETFL, 0)) != O_WRONLY)) {
+			if ((rval = (fcntl(fd0, F_GETFL, 0) & O_ACCMODE)) != O_WRONLY) {
 				tst_resm(TFAIL, "fctnl F_GETFL bad rval on fd0 "
 					"Expected %#x got %#x", O_WRONLY, rval);
 			}
@@ -212,4 +212,4 @@ void cleanup()
 	TEST_CLEANUP;
 
 	tst_rmdir();
-}
\ No newline at end of file
+}
Signature · 17 lines
1.7.3.1

-- 
Best Regards,
Peng Haitao


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 3 lines · Peng Haitao

Hi Garrett,

The file access mode is extracted from the return value of function fcntl() using the mask O_ACCMODE.

Committed -- thanks!
-Garrett

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list