Skip to content

Commit

Permalink
reuse macros to make code more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
freddy77 committed Feb 15, 2025
1 parent ac88d57 commit fed1d83
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/ctlib/ctutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,11 @@ _ct_handle_client_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG
errmsg.msgstringlen = strlen(errmsg.msgstring);

if (msg->oserr) {
#ifdef _WIN32
char *osstr = tds_prwsaerror(msg->oserr);
#else
const char *osstr = strerror(msg->oserr);
#endif
char *osstr = sock_strerror(msg->oserr);

errmsg.osstringlen = (CS_INT) strlen(osstr);
strlcpy(errmsg.osstring, osstr, CS_MAX_MSG);
#ifdef _WIN32
tds_prwsaerror_free(osstr);
#endif
strlcpy(errmsg.osstring, osstr, sizeof(errmsg.osstring));
sock_strerror_free(osstr);
} else {
errmsg.osstring[0] = '\0';
errmsg.osstringlen = 0;
Expand Down

0 comments on commit fed1d83

Please sign in to comment.