[macchanger] Fix fromat string to fix build with -Werror
thoger
thoger at fedoraproject.org
Fri Jul 4 08:50:22 UTC 2014
commit 986252cdb6de254330a568f6db44a25d0fbf1eb6
Author: Tomas Hoger <thoger at redhat.com>
Date: Fri Jul 4 10:52:27 2014 +0200
Fix fromat string to fix build with -Werror
macchanger-1.7.0-werror.diff | 21 ++++++++++++++++++++-
macchanger.spec | 7 +++++--
2 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/macchanger-1.7.0-werror.diff b/macchanger-1.7.0-werror.diff
index a322ff7..cde8412 100644
--- a/macchanger-1.7.0-werror.diff
+++ b/macchanger-1.7.0-werror.diff
@@ -1,4 +1,4 @@
-Fix compile time warning to make it possible to build package with -Werror.
+Fix compile time warnings to make it possible to build package with -Werror.
main.c: In function 'random_seed':
main.c:100:3: warning: ignoring return value of 'read', declared with attribute warn_unused_result [-Wunused-result]
@@ -10,6 +10,13 @@ back to using using predictable, but frequently changing seed. The macchanger
does not require high quality randomness, and the predictable seed method is
already fallback for cases when no random device is available.
+mac.c: In function 'mc_mac_read_string':
+mac.c:116:3: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Werror=format=]
+ fprintf (stderr, "[ERROR] Incorrect format: MAC length should be 17. %s(%lu)\n", string, strlen(string));
+ ^
+
+Fix format string to use %z. Required for 32bit architectures.
+
diff -pruN macchanger-1.7.0.orig/src/main.c macchanger-1.7.0/src/main.c
--- macchanger-1.7.0.orig/src/main.c 2014-07-04 09:44:29.505142598 +0200
+++ macchanger-1.7.0/src/main.c 2014-07-04 10:16:32.238186470 +0200
@@ -33,3 +40,15 @@ diff -pruN macchanger-1.7.0.orig/src/main.c macchanger-1.7.0/src/main.c
gettimeofday (&tv, NULL);
seed = (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec;
}
+diff -pruN macchanger-1.7.0.orig/src/mac.c macchanger-1.7.0/src/mac.c
+--- macchanger-1.7.0.orig/src/mac.c 2013-04-18 07:27:17.000000000 +0200
++++ macchanger-1.7.0/src/mac.c 2014-07-04 10:37:13.074214783 +0200
+@@ -113,7 +113,7 @@ mc_mac_read_string (mac_t *mac, char *st
+
+ /* Check the format */
+ if (strlen(string) != 17) {
+- fprintf (stderr, "[ERROR] Incorrect format: MAC length should be 17. %s(%lu)\n", string, strlen(string));
++ fprintf (stderr, "[ERROR] Incorrect format: MAC length should be 17. %s(%zu)\n", string, strlen(string));
+ return -1;
+ }
+
diff --git a/macchanger.spec b/macchanger.spec
index 1856023..b57e645 100644
--- a/macchanger.spec
+++ b/macchanger.spec
@@ -1,6 +1,6 @@
Name: macchanger
Version: 1.7.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: An utility for viewing/manipulating the MAC address of network interfaces
Group: Applications/System
License: GPLv3+
@@ -18,7 +18,7 @@ Source0: https://github.com/alobbs/%{name}/releases/download/%{version}/%
# prefer /dev/urandom as source of seed for random
Patch1: macchanger-1.7.0-seed-source.diff
-# fix compile time warning to make package build with -Werror
+# fix compile time warnings to make package build with -Werror
Patch2: macchanger-1.7.0-werror.diff
@@ -80,6 +80,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Jul 4 2014 Tomas Hoger <thoger at fedoraproject.org> - 1.7.0-3
+- Format string fix to actually build with -Werror
+
* Fri Jul 4 2014 Tomas Hoger <thoger at fedoraproject.org> - 1.7.0-2
- Build package with -Werror
More information about the scm-commits
mailing list