com php-src: fix error handling: TSRM/tsrm_win32.c
[email protected] (Anatol Belski)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 9719621e078e41aa2d387cea4d4b1dd956c9e1e2 Author: Anatol Belski <[email protected]> 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);