Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcsc: fixed unhandled error on reconnection #3150

Merged
merged 2 commits into from
May 28, 2024

Conversation

frankmorgner
Copy link
Member

fixes #3139

Checklist
  • Documentation is added or updated
  • New files have a LGPL 2.1 license statement
  • PKCS#11 module is tested
  • Windows minidriver is tested
  • macOS tokend is tested

Copy link
Member

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically looks good, but I would prefer to use temporary variable instead of wrapping the pcsc_{re,}connect() functions in the macros.

Even though the macro LOG_TEST_RET is written in a way that it does not evaluate the command more than once, using temporary variables is more readable and easier to debug.

Comment on lines 714 to 716
LOG_TEST_RET(reader->ctx,
pcsc_reconnect(reader, SCARD_LEAVE_CARD),
"Could not reconnect to card after reattached reader.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the old format (with the logging and without the wrapping the whole function into the macro and without the line wrapping)? Something like this (the same for the other cases):

Suggested change
LOG_TEST_RET(reader->ctx,
pcsc_reconnect(reader, SCARD_LEAVE_CARD),
"Could not reconnect to card after reattached reader.");
r = pcsc_reconnect(reader, SCARD_LEAVE_CARD),
LOG_TEST_RET(reader->ctx, r, "Could not reconnect to card after reattached reader.");

additionally, not sure if the PCSC_TRACE was useful for something here, but unless we have very good reason to remove it, I would probably keep it.

Copy link
Member Author

@frankmorgner frankmorgner May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCSC_TRACE only adds logging, which LOG_TEST_RET would do as well.

@xhanulik xhanulik added this to In progress in OpenSC 0.26.0 May 23, 2024
@Jakuje
Copy link
Member

Jakuje commented May 28, 2024

Thank you! Merging.

@Jakuje Jakuje merged commit cd3e8b9 into OpenSC:master May 28, 2024
45 checks passed
OpenSC 0.26.0 automation moved this from In progress to Done May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Recursion too deep in piv_card_reader_lock_obtained
2 participants