diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2015-02-09 19:26:04 -0800 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2015-02-09 19:26:04 -0800 |
commit | 9cd634007f05eeb8fc13b40f87c38060c1f99dfd (patch) | |
tree | 817aecaaf87ef63b901bd765df47cbef54a94af1 /xup | |
parent | ef20d9d507d06de7bb07bc081fb54363663e38f7 (diff) | |
download | xrdp-proprietary-9cd634007f05eeb8fc13b40f87c38060c1f99dfd.tar.gz xrdp-proprietary-9cd634007f05eeb8fc13b40f87c38060c1f99dfd.zip |
fix for case where shmget can return an shmid of zero
Diffstat (limited to 'xup')
-rw-r--r-- | xup/xup.c | 20 | ||||
-rw-r--r-- | xup/xup.h | 1 |
2 files changed, 19 insertions, 2 deletions
@@ -1135,7 +1135,7 @@ process_server_paint_rect_shmem(struct mod *mod, struct stream *s) if (flags == 0) /* screen */ { - if (mod->screen_shmem_id == 0) + if (mod->screen_shmem_id_mapped == 0) { mod->screen_shmem_id = shmem_id; mod->screen_shmem_pixels = g_shmat(mod->screen_shmem_id); @@ -1144,6 +1144,11 @@ process_server_paint_rect_shmem(struct mod *mod, struct stream *s) /* failed */ mod->screen_shmem_id = 0; mod->screen_shmem_pixels = 0; + mod->screen_shmem_id_mapped = 0; + } + else + { + mod->screen_shmem_id_mapped = 1; } } if (mod->screen_shmem_pixels != 0) @@ -1246,10 +1251,21 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s) bmpdata = 0; if (flags == 0) /* screen */ { - if (amod->screen_shmem_id == 0) + if (amod->screen_shmem_id_mapped == 0) { amod->screen_shmem_id = shmem_id; amod->screen_shmem_pixels = g_shmat(amod->screen_shmem_id); + if (amod->screen_shmem_pixels == (void*)-1) + { + /* failed */ + amod->screen_shmem_id = 0; + amod->screen_shmem_pixels = 0; + amod->screen_shmem_id_mapped = 0; + } + else + { + amod->screen_shmem_id_mapped = 1; + } } if (amod->screen_shmem_pixels != 0) { @@ -160,5 +160,6 @@ struct mod int shift_state; struct xrdp_client_info client_info; int screen_shmem_id; + int screen_shmem_id_mapped; /* boolean */ char *screen_shmem_pixels; }; |