Skip to contentSkip to conversation

xfstests: fix format string warnings in locktest.c

PATCH In review Christoph Hellwig 2 participants 6 messages Jan 21, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: fix format string warnings in locktest.c

src/locktest.c +2 -2
Index: xfstests-dev/src/locktest.c
===================================================================
@@ -741,7 +741,7 @@ send_ctl(void)
         if (nwrite < 0)
             perror("send_ctl: write");
         else
-            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %lu as expected\n", 
+            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %zu as expected\n", 
                     ctl.test, nwrite, sizeof(ctl));
         exit(1);
         /*NOTREACHED*/
@@ -756,7 +756,7 @@ void recv_ctl(void)
         if (nread < 0)
             perror("recv_ctl: read");
         else {
-            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %lu as expected\n", 
+            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %zu as expected\n", 
                     ctl.test, nread, sizeof(ctl));
 	    fprintf(stderr, "socket might has been closed by other locktest\n");
 	} 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Christoph Hellwig

Looks good.

Quoted 23 lines

Index: xfstests-dev/src/locktest.c
===================================================================

src/locktest.c +2 -2
@@ -741,7 +741,7 @@ send_ctl(void)
         if (nwrite < 0)
             perror("send_ctl: write");
         else
-            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %lu as expected\n",
+            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %zu as expected\n",
                     ctl.test, nwrite, sizeof(ctl));
         exit(1);
         /*NOTREACHED*/
@@ -756,7 +756,7 @@ void recv_ctl(void)
         if (nread < 0)
             perror("recv_ctl: read");
         else {
-            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %lu as expected\n",
+            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %zu as expected\n",
                     ctl.test, nread, sizeof(ctl));
 	    fprintf(stderr, "socket might has been closed by other locktest\n");
 	}
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 6 lines · Alex Elder
Quoted 1 line · Christoph Hellwig

Looks good.

By the way, the content of this patch is already incorporated in Dave's patch "[7/8] xfstests: fix printf warnings in loctest.c".
http://patchwork.xfs.org/patch/517/

Quoted 21 lines
Quoted 21 lines

Index: xfstests-dev/src/locktest.c
===================================================================

src/locktest.c +2 -2
@@ -741,7 +741,7 @@ send_ctl(void)
         if (nwrite < 0)
             perror("send_ctl: write");
         else
-            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %lu as expected\n",
+            fprintf(stderr, "send_ctl[%d]: write() returns %d, not %zu as expected\n",
                     ctl.test, nwrite, sizeof(ctl));          exit(1);
         /*NOTREACHED*/
@@ -756,7 +756,7 @@ void recv_ctl(void)
         if (nread < 0)
             perror("recv_ctl: read");
         else {
-            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %lu as expected\n",
+            fprintf(stderr, "recv_ctl[%d]: read() returns %d, not %zu as expected\n",
                     ctl.test, nread, sizeof(ctl));
 	    fprintf(stderr, "socket might has been closed by other locktest\n");  	}
 
Quoted 9 lines
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 11 lines · Alex Elder
Quoted 6 lines · Alex Elder
Quoted 1 line · Christoph Hellwig

Looks good.

By the way, the content of this patch is already incorporated in Dave's patch "[7/8] xfstests: fix printf warnings in loctest.c".
http://patchwork.xfs.org/patch/517/

Dave fixed the warnings not quite correctly, he switched from %d which was totally wrong to %lu which is only correct on some 64-bit architectures. %zd is the really correct format.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Alex Elder
Quoted 6 lines · Alex Elder
Quoted 1 line · Christoph Hellwig

Looks good.

Quoted 7 lines
Quoted 3 lines

By the way, the content of this patch is already incorporated in Dave's patch "[7/8] xfstests: fix printf warnings in loctest.c".
http://patchwork.xfs.org/patch/517/

Dave fixed the warnings not quite correctly, he switched from %d which was totally wrong to %lu which is only correct on some 64-bit architectures. %zd is the really correct format.

Ah, yes, you are correct. So the right fix is a combination of the two patches. All I noticed was that when I tried to apply your patch on top of Dave's it didn't work...

Thanks.

-Alex

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw
Quoted 3 lines · Alex Elder

Ah, yes, you are correct. So the right fix is a combination of the two patches. All I noticed was that when I tried to apply your patch on top of Dave's it didn't work...

I just commited mine to the xfstests-dev tree which already contains Dave's patch and everything went fine.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs