com php-src: fix error handling: TSRM/tsrm_win32.c
| From: | Anatol Belski | Date: | Sat, 15 Apr 2017 16:19:33 +0000 |
| Subject: | com php-src: fix error handling: TSRM/tsrm_win32.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97625@lists.php.net to get a copy of this message | ||
Commit: 9719621e078e41aa2d387cea4d4b1dd956c9e1e2
Author: Anatol Belski <ab@php.net> Sat, 15 Apr 2017 18:14:25 +0200
Parents: e433c23b96e81340cd0e2d0b4b7f5fce7f72a931
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9719621e078e41aa2d387cea4d4b1dd956c9e1e2
Log:
fix error handling
Changed paths:
M TSRM/tsrm_win32.c
Diff:
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index f19da4c..9c5fe55 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -671,7 +671,6 @@ TSRM_API int shmget(int key, int size, int flags)
TSRM_API void *shmat(int key, const void *shmaddr, int flags)
{
shm_pair *shm = shm_get(key, NULL);
- int err;
if (!shm->segment) {
return (void*)-1;
@@ -679,8 +678,8 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
shm->addr = MapViewOfFileEx(shm->segment, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
- err = GetLastError();
- if (err) {
+ if (NULL == shm->addr) {
+ int err = GetLastError();
/* Catch more errors */
if (ERROR_NOT_ENOUGH_MEMORY == err) {
_set_errno(ENOMEM);