You're correct.
I made a small patch to remove these warnings and also remove an unused var.
Can someone that uses ltp with uclinux test this patch? Because now the var
hostid will have a different value when UCLINUX is defined.
Thanks,
Ricardo Salveti
On Friday 13 July 2007 17:32:30 Randy Dunlap wrote:
>This patch for UCLINUX:
>http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/gethostid/g
>ethostid01.c?r1=1.16&r2=1.17
>
>doesn't make sense since the following line unconditionally writes
>to the same memory area:
>
>#ifdef UCLINUX
> sprintf(hostid, "%lx", TEST_RETURN);
>#else
> sprintf(hostid, "%0.8lx", TEST_RETURN);
>#endif
> sprintf(hostid, "%0.8lx", TEST_RETURN);
>
>It looks like the 2006-07-27 patch from Jane Lv had this correct,
>with the third sprintf() line not there at all.
>
>
>Also, gcc is complaining about the leading 0. when used with
>%x (hex) output format...
>
>gethostid01.c: In function 'main':
>gethostid01.c:189: warning: '0' flag ignored with precision and '%x' printf
> format gethostid01.c:191: warning: '0' flag ignored with precision and '%x'
> printf format
>
>---
>~Randy
Author: Ricardo Salveti de Araujo <[EMAIL PROTECTED]>
Date: Mon Jul 16 00:35:59 2007 -0300
Fix compilation warnings pointed by Randy Dunlap
Signed-off-by: Ricardo Salveti de Araujo <[EMAIL PROTECTED]>
diff --git a/testcases/kernel/syscalls/gethostid/gethostid01.c b/testcases/kernel/syscalls/gethostid/gethostid01.c
index f2174de..963ab57 100644
--- a/testcases/kernel/syscalls/gethostid/gethostid01.c
+++ b/testcases/kernel/syscalls/gethostid/gethostid01.c
@@ -115,6 +115,7 @@
* 01/31/2006 Marty Ridgeway - Corrected 64 bit check so
* the second 64 bit check doesn't clobber the first 64 bit
* check
+ * 07/2007 Ricardo Salveti de Araujo - Fix compilation warnings
*
*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
@@ -143,7 +144,7 @@ int exp_enos[]={0}; /* must be a 0 terminated list */
int
main(int ac, char **av)
{
- int lc,i,j,location; /* loop counters */
+ int lc,i,j; /* loop counters */
int bit_64 = 0; /* used when compiled 64bit on some 64bit machines */
char *msg; /* message returned from parse_opts */
char *result;
@@ -183,12 +184,12 @@ main(int ac, char **av)
TEST_ERRNO, strerror(TEST_ERRNO));
continue; /* next loop for MTKERNEL */
}
+
#ifdef UCLINUX
sprintf(hostid, "%lx", TEST_RETURN);
#else
- sprintf(hostid, "%0.8lx", TEST_RETURN);
+ sprintf(hostid, "%.8lx", TEST_RETURN);
#endif
- sprintf(hostid, "%0.8lx", TEST_RETURN);
/***************************************************************
* only perform functional verification if flag set (-f not given)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list