Properly check errno if guac_error is GUAC_STATUS_SEE_ERRNO

This commit is contained in:
Michael Jumper 2011-11-24 18:46:06 -08:00
parent 857c2e03c9
commit c6d1916afa

View File

@ -36,6 +36,8 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include <stdlib.h> #include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_LIBPTHREAD #ifdef HAVE_LIBPTHREAD
#include <pthread.h> #include <pthread.h>
@ -49,7 +51,6 @@ const char* __GUAC_STATUS_SUCCESS_STR = "Success";
const char* __GUAC_STATUS_NO_MEMORY_STR = "Insufficient memory"; const char* __GUAC_STATUS_NO_MEMORY_STR = "Insufficient memory";
const char* __GUAC_STATUS_NO_INPUT_STR = "End of input stream"; const char* __GUAC_STATUS_NO_INPUT_STR = "End of input stream";
const char* __GUAC_STATUS_INPUT_TIMEOUT_STR = "Read timeout"; const char* __GUAC_STATUS_INPUT_TIMEOUT_STR = "Read timeout";
const char* __GUAC_STATUS_SEE_ERRNO_STR = "(see value of errno)";
const char* __GUAC_STATUS_OUTPUT_ERROR_STR = "Output error"; const char* __GUAC_STATUS_OUTPUT_ERROR_STR = "Output error";
const char* __GUAC_STATUS_BAD_ARGUMENT_STR = "Invalid argument"; const char* __GUAC_STATUS_BAD_ARGUMENT_STR = "Invalid argument";
const char* __GUAC_STATUS_BAD_STATE_STR = "Illegal state"; const char* __GUAC_STATUS_BAD_STATE_STR = "Illegal state";
@ -78,7 +79,7 @@ const char* guac_status_string(guac_status status) {
/* Further information in errno */ /* Further information in errno */
case GUAC_STATUS_SEE_ERRNO: case GUAC_STATUS_SEE_ERRNO:
return __GUAC_STATUS_SEE_ERRNO_STR; return strerror(errno);
/* Output error */ /* Output error */
case GUAC_STATUS_OUTPUT_ERROR: case GUAC_STATUS_OUTPUT_ERROR: