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

Print logging and debugging messages to stderr #541

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fido2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...)
{
if (tag & tagtable[i].tagn)
{
if (tagtable[i].tag[0] && !(tag & TAG_NO_TAG)) printf("[%s] ", tagtable[i].tag);
if (tagtable[i].tag[0] && !(tag & TAG_NO_TAG)) fprintf(stderr, "[%s] ", tagtable[i].tag);
i = 0;
break;
}
Expand All @@ -86,12 +86,12 @@ void LOG(uint32_t tag, const char * filename, int num, const char * fmt, ...)
#ifdef ENABLE_FILE_LOGGING
if (tag & TAG_FILENO)
{
printf("%s:%d: ", filename, num);
fprintf(stderr, "%s:%d: ", filename, num);
}
#endif
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
vfprintf(stderr, fmt, args);
va_end(args);
}

Expand Down
4 changes: 2 additions & 2 deletions fido2/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void dump_hex(uint8_t * buf, int size)
{
while(size--)
{
printf("%02x ", *buf++);
fprintf(stderr, "%02x ", *buf++);
}
printf("\n");
fprintf(stderr, "\n");
}
6 changes: 3 additions & 3 deletions pc/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void usbhid_close()
void int_handler(int i)
{
usbhid_close();
printf("SIGINT... exiting.\n");
fprintf(stderr, "SIGINT... exiting.\n");
exit(0);
}

Expand Down Expand Up @@ -364,7 +364,7 @@ void authenticator_initialize()
uint8_t * mem;
if (access(state_file, F_OK) != -1)
{
printf("state file exists\n");
fprintf(stderr, "state file exists\n");
f = fopen(state_file, "rb");
if (f== NULL)
{
Expand Down Expand Up @@ -398,7 +398,7 @@ void authenticator_initialize()
}
else
{
printf("state file does not exist, creating it\n");
fprintf(stderr, "state file does not exist, creating it\n");
f = fopen(state_file, "wb+");
if (f== NULL)
{
Expand Down