svn rev #24471: trunk/src/lib/krb5/krb/
raeburn@MIT.EDU
raeburn at MIT.EDU
Sat Oct 23 18:25:51 EDT 2010
http://src.mit.edu/fisheye/changelog/krb5/?cs=24471
Commit By: raeburn
Log Message:
Try harder to retain the "brand" string in the shared library.
Make the brand array non-static, and actually use the value in (the
infrequently-called) krb5_init_secure_context.
Changed Files:
U trunk/src/lib/krb5/krb/brand.c
U trunk/src/lib/krb5/krb/init_ctx.c
Modified: trunk/src/lib/krb5/krb/brand.c
===================================================================
--- trunk/src/lib/krb5/krb/brand.c 2010-10-23 00:38:17 UTC (rev 24470)
+++ trunk/src/lib/krb5/krb/brand.c 2010-10-23 22:25:51 UTC (rev 24471)
@@ -70,4 +70,4 @@
#define BRANDSTR RELTAG " " RELNAME " " RELDATE
-static char krb5_brand[] = "KRB5_BRAND: " BRANDSTR;
+char krb5_brand[] = "KRB5_BRAND: " BRANDSTR;
Modified: trunk/src/lib/krb5/krb/init_ctx.c
===================================================================
--- trunk/src/lib/krb5/krb/init_ctx.c 2010-10-23 00:38:17 UTC (rev 24470)
+++ trunk/src/lib/krb5/krb/init_ctx.c 2010-10-23 22:25:51 UTC (rev 24471)
@@ -91,10 +91,19 @@
krb5_error_code KRB5_CALLCONV
krb5_init_secure_context(krb5_context *context)
{
-
- /* This is to make gcc -Wall happy */
- if(0) krb5_brand[0] = krb5_brand[0];
- return init_common (context, TRUE, FALSE);
+ /*
+ * This is rather silly, but should improve our chances of
+ * retaining the krb5_brand array in the final linked library,
+ * better than a static variable that's unreferenced after
+ * optimization, or even a non-static symbol that's not exported
+ * from the library nor referenced from anywhere else in the
+ * library.
+ *
+ * If someday we grow an API to actually return the string, we can
+ * get rid of this silliness.
+ */
+ int my_false = (krb5_brand[0] == 0);
+ return init_common (context, TRUE, my_false);
}
krb5_error_code
More information about the cvs-krb5
mailing list