From 36dcd37cc7eb6f33417ddeea900f28d13816a4dd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 16 May 2011 23:42:29 -0400 Subject: [PATCH] use %p printf format spec for pointers do not cast to unsigned long since a 64-bit pointer and 32-bit long will truncate the value. Change-Id: Ibeda98171ccbab4b55950bb02c858773e1028cbf --- lib/asn1/gen_template.c | 6 +++--- lib/krb5/scache.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/asn1/gen_template.c b/lib/asn1/gen_template.c index 791fb910f..3a9214a2c 100644 --- a/lib/asn1/gen_template.c +++ b/lib/asn1/gen_template.c @@ -557,7 +557,7 @@ template_members(struct templatehead *temp, const char *basetype, const char *na break; } - if (asprintf(&bname, "bmember_%s_%lu", name ? name : "", (unsigned long)t) < 0 || bname == NULL) + if (asprintf(&bname, "bmember_%s_%p", name ? name : "", t) < 0 || bname == NULL) errx(1, "malloc"); output_name(bname); @@ -620,7 +620,7 @@ template_members(struct templatehead *temp, const char *basetype, const char *na else sename = symbol_name(basetype, t->subtype); - if (asprintf(&tname, "tag_%s_%lu", name ? name : "", (unsigned long)t) < 0 || tname == NULL) + if (asprintf(&tname, "tag_%s_%p", name ? name : "", t) < 0 || tname == NULL) errx(1, "malloc"); output_name(tname); @@ -670,7 +670,7 @@ template_members(struct templatehead *temp, const char *basetype, const char *na else if (t->type == TSequenceOf) type = "A1_OP_SEQOF"; else abort(); - if (asprintf(&elname, "%s_%s_%lu", basetype, tname, (unsigned long)t) < 0 || elname == NULL) + if (asprintf(&elname, "%s_%s_%p", basetype, tname, t) < 0 || elname == NULL) errx(1, "malloc"); generate_template_type(elname, &dupname, NULL, sename, NULL, t->subtype, diff --git a/lib/krb5/scache.c b/lib/krb5/scache.c index cc65cb34c..9051f7bd1 100644 --- a/lib/krb5/scache.c +++ b/lib/krb5/scache.c @@ -518,8 +518,8 @@ scc_resolve(krb5_context context, krb5_ccache *id, const char *res) sqlite3_reset(s->scache_name); krb5_set_error_message(context, KRB5_CC_END, N_("Cache name of wrong type " - "for scache %ld", ""), - (unsigned long)s->name); + "for scache %s", ""), + s->name); scc_free(s); return KRB5_CC_END; } @@ -902,8 +902,8 @@ scc_get_first (krb5_context context, return KRB5_CC_END; } - ret = asprintf(&name, "credIteration%luPid%d", - (unsigned long)ctx, (int)getpid()); + ret = asprintf(&name, "credIteration%pPid%d", + ctx, (int)getpid()); if (ret < 0 || name == NULL) { krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", "")); @@ -1173,8 +1173,8 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor) return ret; } - ret = asprintf(&name, "cacheIteration%luPid%d", - (unsigned long)ctx, (int)getpid()); + ret = asprintf(&name, "cacheIteration%pPid%d", + ctx, (int)getpid()); if (ret < 0 || name == NULL) { krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", "")); -- 2.11.4.GIT