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 diff --git a/xup/xup.c b/xup/xup.c index 0643cb39..89ca9f06 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -31,6 +31,7 @@ #include #include #include +#include /******************************************************************************/ /** @@ -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) {