[ykpers] fix build on big endians and with default unsigned char (like s390(x))

Dan Horák sharkcz at fedoraproject.org
Fri Apr 29 15:16:00 UTC 2011


commit 0a9fa8920fc3241ecc1b62968aac277b9e08951d
Author: Dan Horák <dan at danny.cz>
Date:   Fri Apr 29 17:15:47 2011 +0200

    fix build on big endians and with default unsigned char (like s390(x))

 ykpers-1.4.1-bigendian.patch |   11 +++++++++++
 ykpers-1.4.1-getopt.patch    |   12 ++++++++++++
 ykpers.spec                  |    9 ++++++++-
 3 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/ykpers-1.4.1-bigendian.patch b/ykpers-1.4.1-bigendian.patch
new file mode 100644
index 0000000..4b8b59a
--- /dev/null
+++ b/ykpers-1.4.1-bigendian.patch
@@ -0,0 +1,11 @@
+diff -up ykpers-1.4.1/tests/test_args_to_config.c.bigendian ykpers-1.4.1/tests/test_args_to_config.c
+--- ykpers-1.4.1/tests/test_args_to_config.c.bigendian	2011-04-29 17:09:24.000000000 +0200
++++ ykpers-1.4.1/tests/test_args_to_config.c	2011-04-29 17:09:37.000000000 +0200
+@@ -86,6 +86,7 @@ void _check_success(int rc, YKP_CONFIG *
+ 	/* insert CRC */
+ 	ycfg->crc = ~yubikey_crc16 ((unsigned char *) ycfg,
+ 				    offsetof(struct config_st, crc));
++	ycfg->crc = yk_endian_swap_16(ycfg->crc);
+ 
+ 	config_matches_expected = ! memcmp(expected, ycfg, sizeof(*ycfg));
+ 	if (! config_matches_expected) {
diff --git a/ykpers-1.4.1-getopt.patch b/ykpers-1.4.1-getopt.patch
new file mode 100644
index 0000000..6a01ef7
--- /dev/null
+++ b/ykpers-1.4.1-getopt.patch
@@ -0,0 +1,12 @@
+diff -up ykpers-1.4.1/ykpersonalize.c.getopt ykpers-1.4.1/ykpersonalize.c
+--- ykpers-1.4.1/ykpersonalize.c.getopt	2011-04-29 16:05:30.000000000 +0200
++++ ykpers-1.4.1/ykpersonalize.c	2011-04-29 16:05:45.000000000 +0200
+@@ -205,7 +205,7 @@ int args_to_config(int argc, char **argv
+ 		   bool *aesviahash,
+ 		   int *exit_code)
+ {
+-	char c;
++	int c;
+ 	const char *aeshash = NULL;
+ 	bool new_access_code = false;
+ 	bool slot_chosen = false;
diff --git a/ykpers.spec b/ykpers.spec
index 2f11362..75b59e9 100644
--- a/ykpers.spec
+++ b/ykpers.spec
@@ -1,12 +1,14 @@
 Name:           ykpers
 Version:        1.4.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Yubikey personalization program
 
 Group:          Applications/System
 License:        BSD
 URL:            http://code.google.com/p/yubikey-personalization/
 Source0:        http://yubikey-personalization.googlecode.com/files/%{name}-%{version}.tar.gz
+Patch0:         %{name}-1.4.1-getopt.patch
+Patch1:         %{name}-1.4.1-bigendian.patch
 
 %ifnarch s390 s390x
 BuildRequires: libusb1-devel
@@ -30,6 +32,8 @@ use ykpers.
 
 %prep
 %setup -q
+%patch0 -p1 -b .getopt
+%patch1 -p1 -b .bigendian
 
 %build
 %configure --disable-static \
@@ -75,6 +79,9 @@ pwd
 %exclude %{_libdir}/libykpers-1.la
 
 %changelog
+* Fri Apr 29 2011 - Dan Horák <dan[at]danny.cz> - 1.4.1-2
+- fix build on big endians and with default unsigned char (like s390(x))
+
 * Tue Feb 6 2011 - Maxim Burgerhout <wzzrd at fedoraproject.org> - 1.4.1-1
 - Add support for new features in YubiKey 2.2.
 - Stricter argument parsing, to help user avoid configuration surprises.


More information about the scm-commits mailing list