coreutils
[Top][All Lists]
Advanced

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

[PATCH] build: tail: avoid type/format mismatch warning from gcc


From: Jim Meyering
Subject: [PATCH] build: tail: avoid type/format mismatch warning from gcc
Date: Mon, 02 Jan 2012 22:07:42 +0100

FYI, I saw this on a 686 system using
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)

tail.c: In function 'fremote':
tail.c:908:18: error: format '%lx' expects argument of type 'long unsigned int',
  but argument 4 has type 'int' [-Werror=format]


>From 658a91d573f148dd0db51eaaa4d7c337d0035031 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 2 Jan 2012 21:28:15 +0100
Subject: [PATCH] build: tail: avoid type/format mismatch warning from gcc

Without this change, gcc's -Werror=format would complain that
the '%lx' format requires 'long unsigned int', not 'int'.
* src/tail.c (fremote): Use a temporary variable.
---
 src/tail.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/tail.c b/src/tail.c
index 41817e4..eae5741 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -903,10 +903,13 @@ fremote (int fd, const char *name)
         case 0:
           break;
         case -1:
-          error (0, 0, _("unrecognized file system type 0x%08lx for %s. "
-                         "please report this to %s. reverting to polling"),
-                 buf.f_type, quote (name), PACKAGE_BUGREPORT);
-          /* Treat as "remote", so caller polls.  */
+          {
+            unsigned long int fs_type = buf.f_type;
+            error (0, 0, _("unrecognized file system type 0x%08lx for %s. "
+                           "please report this to %s. reverting to polling"),
+                   fs_type, quote (name), PACKAGE_BUGREPORT);
+            /* Treat as "remote", so caller polls.  */
+          }
           break;
         case 1:
           remote = false;
--
1.7.8.1.391.g2c2ad



reply via email to

[Prev in Thread] Current Thread [Next in Thread]