+2015-04-12 Corinna Vinschen <corinna@vinschen.de>
+
+ * shm.cc (shmget): Fetch segment size from server rather than using
+ size argument to accommodate existing segments. Add comment to explain
+ why.
+
2015-04-10 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2000.
- Fix UTF-16 surrogate handling in wctomb and friends.
Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00452.html
+
+- Fix shmget usage of size parameter for already existing segments.
+ Addresses: https://cygwin.com/ml/cygwin/2015-04/msg00105.html
shmid and hdl value to the list. */
ssh_new_entry->shmid = shmid;
ssh_new_entry->hdl = hdl;
- ssh_new_entry->size = size;
+ /* Fetch segment size from server. If this is an already existing segment,
+ the size value in this shmget call is supposed to be meaningless. */
+ struct shmid_ds stat;
+ client_request_shm stat_req (shmid, IPC_STAT, &stat);
+ if (stat_req.make_request () == -1 || stat_req.retval () == -1)
+ ssh_new_entry->size = size;
+ else
+ ssh_new_entry->size = stat.shm_segsz;
ssh_new_entry->ref_count = 0;
SLIST_INSERT_HEAD (&ssh_list, ssh_new_entry, ssh_next);
SLIST_UNLOCK ();