krb5 commit: Harmonize struct packing for gic_opt.c

Tom Yu tlyu at mit.edu
Thu Feb 18 14:04:10 EST 2016


https://github.com/krb5/krb5/commit/f162f792e04541a5158b791523b82a60a9d80913
commit f162f792e04541a5158b791523b82a60a9d80913
Author: Tom Yu <tlyu at mit.edu>
Date:   Wed Feb 17 15:58:24 2016 -0500

    Harmonize struct packing for gic_opt.c
    
    struct extended_options in gic_opt.c extends krb5_get_init_creds_opt.
    On Mac OS X, for historical reasons, we define krb5_get_init_creds_opt
    with an alignment/packing of 2, conflicting with the compiler default.
    This results in alignment change warnings from clang on Mac OS X.
    Ensure that extended_options has the same packing.

 src/lib/krb5/krb/gic_opt.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/lib/krb5/krb/gic_opt.c b/src/lib/krb5/krb/gic_opt.c
index 4d4e46b..d4b8918 100644
--- a/src/lib/krb5/krb/gic_opt.c
+++ b/src/lib/krb5/krb/gic_opt.c
@@ -8,6 +8,14 @@
 
 #define DEFAULT_FLAGS KRB5_GET_INIT_CREDS_OPT_CHG_PWD_PRMPT
 
+#if defined(__MACH__) && defined(__APPLE__)
+#include <TargetConditionals.h>
+#endif
+
+/* Match struct packing of krb5_get_init_creds_opt on MacOS X. */
+#if TARGET_OS_MAC
+#pragma pack(push,2)
+#endif
 struct extended_options {
     krb5_get_init_creds_opt opt;
     int num_preauth_data;
@@ -21,6 +29,9 @@ struct extended_options {
     krb5_responder_fn responder;
     void *responder_data;
 };
+#if TARGET_OS_MAC
+#pragma pack(pop)
+#endif
 
 void KRB5_CALLCONV
 krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt)


More information about the cvs-krb5 mailing list