diff options
author | Werner Koch <[email protected]> | 2008-11-03 10:54:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2008-11-03 10:54:18 +0000 |
commit | 338ddd0bb63efac5466939f06a4772c55a6b14aa (patch) | |
tree | 91e5452da6a7c8e2936ce0b261cd42bd3705da38 /scd/app.c | |
parent | Check that the socket is well and served by us. (diff) | |
download | gnupg-338ddd0bb63efac5466939f06a4772c55a6b14aa.tar.gz gnupg-338ddd0bb63efac5466939f06a4772c55a6b14aa.zip |
Use bin2hex if possible.
Diffstat (limited to 'scd/app.c')
-rw-r--r-- | scd/app.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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; } |