Re: tools/locktest/testlk.c:84: argument 4 has type ‘__off64_t {aka long long int}’

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

i see, email likes also no tabs. Patch as attachment.

best regards
  Philipp
fl.l_start and fl.l_len are 64 bit wide. It has been assumed that long
is 64 bit in a printf(), which is incorrect on a 32 bit archtecture

* 1st change suppress fall through warning from gcc-7 and higher
* 2nd change removes whitespace
* 3rd change is this bug and changes this into a long long

Signed-off-by: Philipp Psurek <philipp.psurek@xxxxxxxxx>
---

--- a/tools/locktest/testlk.c    2018-05-22 20:33:01.000000000 +0200
+++ b/tools/locktest/testlk.c    2018-06-03 17:26:36.800202901 +0200
@@ -28,6 +28,7 @@
 		switch (c) {
 		case 'h':
 			usage(0);
+			/* fall through */
 		case 'r':
 			cmd = F_SETLK;
 			typ = F_RDLCK;
@@ -75,13 +76,13 @@
 	if (fcntl(fd, cmd, &fl) < 0)
 		fatal("fcntl");
 	printf("fcntl: ok\n");
-	
+
 	/* printf("TP2\n"); */
 	if (cmd == F_GETLK) {
 		if (fl.l_type == F_UNLCK) {
 			printf("%s: no conflicting lock\n", fname);
 		} else {
-			printf("%s: conflicting lock by %d on (%ld;%ld)\n",
+			printf("%s: conflicting lock by %d on (%lld;%lld)\n",
 				fname, fl.l_pid, fl.l_start, fl.l_len);
 		}
 		return 0;


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux