blob: 0d5d78bdae0d6f10d9d54986a792128933c9d361 [file] [log] [blame]
fix that is already in upstream x11vnc-0.9.14 dev
from ChromiumOS:
x11vnc: Fix shm close on early shutdown.
Global structures {scanline,fullscreen,scanrect}_shm are initialized to
zero, including the .shmid field. This creates problems when shutdown /
clean_shm is called before these structures are properly initialized in
initialize_polling_images. shm_delete will be called on the structure,
and since the shmid isn't -1, shmctl(id, IPC_RMID...) will be called for
id=0. id=0 is in fact a valid shmid, and it might belong to some other
shared memory for some other processes, creating many potential problems.
Fix is to initialize shmid to -1 to indicate that it is in fact
uninitialized.
https://chromium-review.googlesource.com/37971
--- a/x11vnc/x11vnc_defs.c
+++ b/x11vnc/x11vnc_defs.c
@@ -82,10 +82,10 @@
XImage *raw_fb_image = NULL; /* the raw fb */
/* corresponding shm structures */
-XShmSegmentInfo scanline_shm;
-XShmSegmentInfo fullscreen_shm;
+XShmSegmentInfo scanline_shm = {.shmid = -1};
+XShmSegmentInfo fullscreen_shm = {.shmid = -1};
XShmSegmentInfo *tile_row_shm; /* for all possible row runs */
-XShmSegmentInfo snaprect_shm;
+XShmSegmentInfo snaprect_shm = {.shmid = -1};
/* rfb screen info */
rfbScreenInfoPtr screen = NULL;