Skip to content

Commit

Permalink
fcntl: fix lock type interpretation
Browse files Browse the repository at this point in the history
The lock type switching from an integer to a string in those
testcases are wrong because of typo I believe. As part of a
batch porting, fcntl17.c did it right.

In /usr/include/asm-generic/fcntl.h:166 defines the posix file
lock type value:

Those testcases mistook them as 1, 2, 3 respectively.

This does not affect the test verdict, but is printing wrong
message when the type is really not match, for example when
testing on CIFS.

Signed-off-by: Murphy Zhou <[email protected]>
Reviewed-by: Li Wang <[email protected]>
  • Loading branch information
Murphy Zhou authored and wangli5665 committed Jun 6, 2023
1 parent 71a3681 commit 97c2fdb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions testcases/kernel/syscalls/fcntl/fcntl11.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ char *str_type(int type)
static char buf[20];

switch (type) {
case 0:
case F_RDLCK:
return ("F_RDLCK");
case 1:
case F_WRLCK:
return ("F_WRLCK");
case 2:
case F_UNLCK:
return ("F_UNLCK");
default:
sprintf(buf, "BAD VALUE: %d", type);
Expand Down
6 changes: 3 additions & 3 deletions testcases/kernel/syscalls/fcntl/fcntl19.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ char *str_type(int type)
static char buf[20];

switch (type) {
case 1:
case F_RDLCK:
return ("F_RDLCK");
case 2:
case F_WRLCK:
return ("F_WRLCK");
case 3:
case F_UNLCK:
return ("F_UNLCK");
default:
sprintf(buf, "BAD VALUE: %d", type);
Expand Down
6 changes: 3 additions & 3 deletions testcases/kernel/syscalls/fcntl/fcntl20.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ char *str_type(int type)
static char buf[20];

switch (type) {
case 1:
case F_RDLCK:
return ("F_RDLCK");
case 2:
case F_WRLCK:
return ("F_WRLCK");
case 3:
case F_UNLCK:
return ("F_UNLCK");
default:
sprintf(buf, "BAD VALUE: %d", type);
Expand Down
6 changes: 3 additions & 3 deletions testcases/kernel/syscalls/fcntl/fcntl21.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ char *str_type(int type)
static char buf[20];

switch (type) {
case 1:
case F_RDLCK:
return ("F_RDLCK");
case 2:
case F_WRLCK:
return ("F_WRLCK");
case 3:
case F_UNLCK:
return ("F_UNLCK");
default:
sprintf(buf, "BAD VALUE: %d", type);
Expand Down

0 comments on commit 97c2fdb

Please sign in to comment.