Skip to content

Commit 97c2fdb

Browse files
Murphy Zhouwangli5665
authored andcommitted
fcntl: fix lock type interpretation
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]>
1 parent 71a3681 commit 97c2fdb

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

testcases/kernel/syscalls/fcntl/fcntl11.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ char *str_type(int type)
189189
static char buf[20];
190190

191191
switch (type) {
192-
case 0:
192+
case F_RDLCK:
193193
return ("F_RDLCK");
194-
case 1:
194+
case F_WRLCK:
195195
return ("F_WRLCK");
196-
case 2:
196+
case F_UNLCK:
197197
return ("F_UNLCK");
198198
default:
199199
sprintf(buf, "BAD VALUE: %d", type);

testcases/kernel/syscalls/fcntl/fcntl19.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ char *str_type(int type)
215215
static char buf[20];
216216

217217
switch (type) {
218-
case 1:
218+
case F_RDLCK:
219219
return ("F_RDLCK");
220-
case 2:
220+
case F_WRLCK:
221221
return ("F_WRLCK");
222-
case 3:
222+
case F_UNLCK:
223223
return ("F_UNLCK");
224224
default:
225225
sprintf(buf, "BAD VALUE: %d", type);

testcases/kernel/syscalls/fcntl/fcntl20.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ char *str_type(int type)
214214
static char buf[20];
215215

216216
switch (type) {
217-
case 1:
217+
case F_RDLCK:
218218
return ("F_RDLCK");
219-
case 2:
219+
case F_WRLCK:
220220
return ("F_WRLCK");
221-
case 3:
221+
case F_UNLCK:
222222
return ("F_UNLCK");
223223
default:
224224
sprintf(buf, "BAD VALUE: %d", type);

testcases/kernel/syscalls/fcntl/fcntl21.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ char *str_type(int type)
222222
static char buf[20];
223223

224224
switch (type) {
225-
case 1:
225+
case F_RDLCK:
226226
return ("F_RDLCK");
227-
case 2:
227+
case F_WRLCK:
228228
return ("F_WRLCK");
229-
case 3:
229+
case F_UNLCK:
230230
return ("F_UNLCK");
231231
default:
232232
sprintf(buf, "BAD VALUE: %d", type);

0 commit comments

Comments
 (0)