This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] readline/util.c: use '%d' instead of 'ld' to avoid compiling warning
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: jan dot kratochvil at redhat dot com, drow at false dot org, ezannoni at kwikemart dot cygnus dot com, brobecker at gnat dot com, muller at sourceware dot org, palves at redhat dot com, nickc at redhat dot com, macro at linux-mips dot org, clm at redhat dot com, amodra at gmail dot com
- Cc: binutils at sourceware dot org
- Date: Fri, 30 May 2014 08:11:41 +0800
- Subject: [PATCH] readline/util.c: use '%d' instead of 'ld' to avoid compiling warning
- Authentication-results: sourceware.org; auth=none
getpid() will return 'pid_t' which is always 'int', so need use '%d'
instead of '%ld' in sprintf().
The related warning (cross-compile aarch64):
../../binutils-gdb/readline/util.c: In function ‘_rl_tropen’:
../../binutils-gdb/readline/util.c:510:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘__pid_t’ [-Wformat]
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
readline/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readline/util.c b/readline/util.c
index 321dee2..05c8abc 100644
--- a/readline/util.c
+++ b/readline/util.c
@@ -507,7 +507,7 @@ _rl_tropen ()
if (_rl_tracefp)
fclose (_rl_tracefp);
- sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid());
+ sprintf (fnbuf, "/var/tmp/rltrace.%d", getpid());
unlink(fnbuf);
_rl_tracefp = fopen (fnbuf, "w+");
return _rl_tracefp != 0;
--
1.9.2.459.g68773ac