diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c
index fccdefd46e..bc60091964 100644
--- a/src/mod/applications/mod_conference/mod_conference.c
+++ b/src/mod/applications/mod_conference/mod_conference.c
@@ -1029,12 +1029,8 @@ static void conference_cdr_render(conference_obj_t *conference)
 		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)));
 	}
 
 	
diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
index e07871b88d..7b1cf2a6a9 100644
--- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
+++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
@@ -253,12 +253,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 				}
 			} 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);
 		}
@@ -412,12 +408,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 					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)));
 
 				}
 
diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
index 44379444e3..28f4ae2e44 100644
--- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
+++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
@@ -244,12 +244,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 				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);
 		}
@@ -400,12 +396,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 				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)));
 			}
 		}
 	}
diff --git a/src/switch_utils.c b/src/switch_utils.c
index b0c4e1a287..d877061e39 100644
--- a/src/switch_utils.c
+++ b/src/switch_utils.c
@@ -2985,6 +2985,12 @@ SWITCH_DECLARE(char *) switch_strerror_r(int errnum, char *buf, switch_size_t bu
 	}
 	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);