1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Use bin2hex if possible.

This commit is contained in:
Werner Koch 2008-11-03 10:54:18 +00:00
parent 8997c155e3
commit 338ddd0bb6
8 changed files with 34 additions and 53 deletions

View file

@ -106,6 +106,7 @@ static void
dump_mutex_state (pth_mutex_t *m)
{
#ifdef _W32_PTH_H
(void)m;
log_printf ("unknown under W32");
#else
if (!(m->mx_state & PTH_MUTEX_INITIALIZED))
@ -186,7 +187,7 @@ application_notify_card_removed (int slot)
}
/* This fucntion is used by the serialno command to check for an
/* This function is used by the serialno command to check for an
application conflict which may appear if the serialno command is
used to request a specific application and the connection has
already done a select_application. */
@ -472,8 +473,7 @@ app_munge_serialno (app_t app)
gpg_error_t
app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp)
{
char *buf, *p;
int i;
char *buf;
if (!app || !serial)
return gpg_error (GPG_ERR_INV_VALUE);
@ -482,12 +482,10 @@ app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp)
if (stamp)
*stamp = 0; /* not available */
buf = xtrymalloc (app->serialnolen * 2 + 1);
buf = bin2hex (app->serialno, app->serialnolen, NULL);
if (!buf)
return gpg_error_from_syserror ();
for (p=buf, i=0; i < app->serialnolen; p +=2, i++)
sprintf (p, "%02X", app->serialno[i]);
*p = 0;
*serial = buf;
return 0;
}