diff options
Diffstat (limited to 'src/ptunnel.c')
-rw-r--r-- | src/ptunnel.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ptunnel.c b/src/ptunnel.c index 7ac7ecb..c83ee24 100644 --- a/src/ptunnel.c +++ b/src/ptunnel.c @@ -63,11 +63,13 @@ /** Local error string storage */ static char errorstr[255]; static char * print_last_windows_error() { + char last_errorstr[255]; DWORD last_error = GetLastError(); - memset(errorstr, 0, sizeof(errorstr)); + + memset(last_errorstr, 0, sizeof(last_errorstr)); FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, last_error, 0, errorstr, sizeof(errorstr), NULL); - snprintf(errorstr, sizeof(errorstr), "%s (%lu)", errorstr, last_error); + NULL, last_error, 0, last_errorstr, sizeof(last_errorstr), NULL); + snprintf(errorstr, sizeof(errorstr), "%s (%lu)", last_errorstr, last_error); return errorstr; } #define strerror(x) print_last_windows_error() |