Convert mod_xml_cdr, mod_json_cdr and mod_conference to the new function.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
fd = -1;
} else {
char ebuf[512] = { 0 };
-#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
-#else
- strerror_r(errno, ebuf, sizeof(ebuf));
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n",
+ path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
}
} else {
char ebuf[512] = { 0 };
-#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
-#else
- strerror_r(errno, ebuf, sizeof(ebuf));
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n",
+ path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
switch_safe_free(path);
}
break;
} else {
char ebuf[512] = { 0 };
-#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
-#else
- strerror_r(errno, ebuf, sizeof(ebuf));
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s! [%s]\n", path, ebuf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s! [%s]\n",
+ path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
fd = -1;
} else {
char ebuf[512] = { 0 };
-#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
-#else
- strerror_r(errno, ebuf, sizeof(ebuf));
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n",
+ path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
switch_safe_free(path);
}
fd = -1;
} else {
char ebuf[512] = { 0 };
-#ifdef WIN32
- strerror_s(ebuf, sizeof(ebuf), errno);
-#else
- strerror_r(errno, ebuf, sizeof(ebuf));
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n",
+ switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
}
}
}
return buf;
#endif /* STRERROR_R_CHAR_P */
+#elif defined(WIN32)
+ /* WIN32 variant */
+ if (strerror_s(buf, buflen, errnum)) {
+ switch_snprintf(buf, buflen, "Unknown error %d", errnum);
+ }
+ return buf;
#else
/* Fallback, copy string into private buffer */
switch_copy_string(buf, strerror(errnum), buflen);