diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-10-31 10:14:06 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-10-31 10:14:06 -0500 |
commit | acba391493badb972db654fa1299052fce0379a3 (patch) | |
tree | bfd6f7a557cbe65ed77e83ceb2c404fa0f4fd870 | |
parent | eca968d0d4250fe95abbc7ea99f887142f44b4e0 (diff) | |
parent | d9676f82e54cc7503ad3eb28f996edfeff58a870 (diff) | |
download | qemu-acba391493badb972db654fa1299052fce0379a3.zip qemu-acba391493badb972db654fa1299052fce0379a3.tar.gz qemu-acba391493badb972db654fa1299052fce0379a3.tar.bz2 |
Merge remote-tracking branch 'alon/pull-libcacard-assert' into staging
-rw-r--r-- | libcacard/cac.c | 3 | ||||
-rw-r--r-- | libcacard/card_7816.c | 2 | ||||
-rw-r--r-- | libcacard/vscclient.c | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/libcacard/cac.c b/libcacard/cac.c index f4b0b1b..927a4ca 100644 --- a/libcacard/cac.c +++ b/libcacard/cac.c @@ -266,7 +266,8 @@ static void cac_delete_pki_applet_private(VCardAppletPrivate *applet_private) { CACPKIAppletData *pki_applet_data = NULL; - if (pki_applet_data == NULL) { + + if (applet_private == NULL) { return; } pki_applet_data = &(applet_private->u.pki_data); diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c index 9fd59d4..6fe27d5 100644 --- a/libcacard/card_7816.c +++ b/libcacard/card_7816.c @@ -754,7 +754,7 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response) return vcard7816_vm_process_apdu(card, apdu, response); case VCARD_DIRECT: /* if we are type direct, then the applet should handle everything */ - assert("VCARD_DIRECT: applet failure"); + assert(!"VCARD_DIRECT: applet failure"); break; } *response = diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index 2191f60..e317a25 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -357,6 +357,7 @@ connect_to_qemu( if (sock < 0) { /* Error */ fprintf(stderr, "Error opening socket!\n"); + return -1; } memset(&hints, 0, sizeof(struct addrinfo)); @@ -370,13 +371,13 @@ connect_to_qemu( if (ret != 0) { /* Error */ fprintf(stderr, "getaddrinfo failed\n"); - return 5; + return -1; } if (connect(sock, server->ai_addr, server->ai_addrlen) < 0) { /* Error */ fprintf(stderr, "Could not connect\n"); - return 5; + return -1; } if (verbose) { printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader)); @@ -505,6 +506,10 @@ main( qemu_host = strdup(argv[argc - 2]); qemu_port = strdup(argv[argc - 1]); sock = connect_to_qemu(qemu_host, qemu_port); + if (sock == -1) { + fprintf(stderr, "error opening socket, exiting.\n"); + exit(5); + } qemu_mutex_init(&write_lock); qemu_mutex_init(&pending_reader_lock); |