Skip to contentSkip to conversation

lstat/lstat03.c: Fix broken file type check

PATCH In review Nicolas Joly 2 participants 2 messages Jun 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lstat/lstat03.c: Fix broken file type check

---
 testcases/kernel/syscalls/lstat/lstat03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/lstat/lstat03.c +1 -1
index d48d1ab..2d8716c 100644
@@ -131,7 +131,7 @@ int main(int ac, char **av)
 		 */
 		if ((stat_buf.st_uid != user_id) ||
 		    (stat_buf.st_gid != group_id) ||
-		    (!(stat_buf.st_mode && S_IFLNK)) ||
+		    (!(stat_buf.st_mode & S_IFLNK)) ||
 		    (stat_buf.st_size != strlen(TESTFILE))) {
 			tst_resm(TFAIL, "Functionality of lstat(2) on "
 				 "'%s' Failed", SFILE);
Signature · 13 lines
1.9.0


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 10 lines
---
 testcases/kernel/syscalls/lstat/lstat03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/lstat/lstat03.c +0 -0
index d48d1ab..2d8716c 100644

testcases/kernel/syscalls/lstat/lstat03.c int main(int ac, char **av) · line 134

Quoted 5 lines
testcases/kernel/syscalls/lstat/lstat03.c +1 -1
@@ -131,7 +131,7 @@ int main(int ac, char **av)
 		 */
 		if ((stat_buf.st_uid != user_id) ||
 		    (stat_buf.st_gid != group_id) ||
-		    (!(stat_buf.st_mode && S_IFLNK)) ||
+		    (!(stat_buf.st_mode & S_IFLNK)) ||

Good catch, although this is not yet correct. The file types are not bitflags so the correct way here is:

	((stat_buf.st_mode & S_IFMT) != S_IFLNK)

I've corrected the patch and pushed, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list