All pastes #59854 Raw Edit

Anonymous

public c v1 · immutable
#59854 ·published 2006-05-30 08:44 UTC
rendered paste body
                                /* Check card */                                unsigned char buffer [6];                                unsigned int id;                                int rv;                                sc_card_t *card;                                sc_path_t path;                                /* Check card */                                rv = sc_connect_card (client->reader, 0, &card);                                if (rv != SC_SUCCESS)                                {                                        event = SC_EVENT_CARD_REMOVED;                                        goto error;                                }                                /* Read ID */                                sc_format_path("I1000", &path);                                rv = sc_select_file(card, &path, NULL);                                if (rv != SC_SUCCESS)                                {                                        fprintf (stderr, "Couldn't select file\n");                                        sc_disconnect_card (card, 0);                                        event = SC_EVENT_CARD_REMOVED;                                        goto error;                                }                                rv = sc_read_record(card, 0, buffer,6,0);                                if (rv < 0)                                {                                        fprintf (stderr, "Couldn't read record\n");                                        sc_disconnect_card (card, 0);                                        event = SC_EVENT_CARD_REMOVED;                                        goto error;                                }                                sc_disconnect_card (card, 0);                                id = buffer[5];                                event = 3;                                write (client->pipe[1], &event, 1);                                write (client->pipe[1], &id, sizeof (int));