mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
MFB51: Cleanup code and prevent usage of uninitialized variable.
This commit is contained in:
parent
1518ba3bf7
commit
ed5383b811
1 changed files with 1 additions and 11 deletions
|
@ -169,17 +169,11 @@ PHP_MINIT_FUNCTION(sysvsem)
|
||||||
Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
|
Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
|
||||||
PHP_FUNCTION(sem_get)
|
PHP_FUNCTION(sem_get)
|
||||||
{
|
{
|
||||||
long key, max_acquire, perm, auto_release = 1;
|
long key, max_acquire = 1, perm = 0666, auto_release = 1;
|
||||||
int semid;
|
int semid;
|
||||||
struct sembuf sop[3];
|
struct sembuf sop[3];
|
||||||
int count;
|
int count;
|
||||||
sysvsem_sem *sem_ptr;
|
sysvsem_sem *sem_ptr;
|
||||||
#if HAVE_SEMUN
|
|
||||||
union semun un;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
max_acquire = 1;
|
|
||||||
perm = 0666;
|
|
||||||
|
|
||||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) {
|
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -231,11 +225,7 @@ PHP_FUNCTION(sem_get)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the usage count. */
|
/* Get the usage count. */
|
||||||
#if HAVE_SEMUN
|
|
||||||
count = semctl(semid, SYSVSEM_USAGE, GETVAL, un);
|
|
||||||
#else
|
|
||||||
count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
|
count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
|
||||||
#endif
|
|
||||||
if (count == -1) {
|
if (count == -1) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue