diff options
author | Timothy Pearson <tpearson@raptorengineering.com> | 2019-03-16 18:57:45 -0500 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-03-16 19:22:20 -0500 |
commit | a2fb82658aa246024b067cebc68948ab90d02b0a (patch) | |
tree | b7ca27dea26983558a94f16b746a0d49f9ab30b6 | |
parent | ee65dc6e52e0d484e6384d7e96253ddf3a12b4bc (diff) | |
download | xrdp-proprietary-ulab-next.tar.gz xrdp-proprietary-ulab-next.zip |
Fix crash when SHM not availableulab-next
Enhance debug logging of SHM related functions
-rw-r--r-- | common/os_calls.c | 4 | ||||
-rw-r--r-- | xup/xup.c | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 1d3a71b1..c69024c4 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -3168,12 +3168,12 @@ g_text2bool(const char *s) } /*****************************************************************************/ -/* returns pointer or nil on error */ +/* returns pointer or -1 on error */ void * APP_CC g_shmat(int shmid) { #if defined(_WIN32) - return 0; + return -1; #else return shmat(shmid, 0, 0); #endif @@ -31,6 +31,7 @@ #include <unistd.h> #include <fcntl.h> #include <netdb.h> +#include <errno.h> /******************************************************************************/ /** @@ -1232,6 +1233,11 @@ process_server_paint_rect_shmem(struct mod *mod, struct stream *s) { mod->screen_shmem_id = shmem_id; mod->screen_shmem_pixels = g_shmat(mod->screen_shmem_id); + if (mod->screen_shmem_pixels == (void *)-1) + { + mod->screen_shmem_pixels = 0; + log_message(LOG_LEVEL_ERROR, "g_shmat() returned error, errno: %d\nIs X11rdp running on the same host as xrdp?\n", errno); + } } if (mod->screen_shmem_pixels != 0) { @@ -1341,6 +1347,11 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s) { amod->screen_shmem_id = shmem_id; amod->screen_shmem_pixels = g_shmat(amod->screen_shmem_id); + if (amod->screen_shmem_pixels == (void *)-1) + { + amod->screen_shmem_pixels = 0; + log_message(LOG_LEVEL_ERROR, "g_shmat() returned error, errno: %d\nIs X11rdp running on the same host as xrdp?\n", errno); + } } if (amod->screen_shmem_pixels != 0) { |