summaryrefslogtreecommitdiff
path: root/ext/sysvsem
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-15 22:54:15 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-15 22:54:15 +0000
commit84cd3c125ced37d97f8028f85876964a0d6ab3db (patch)
tree88dd24bf9ecae206ec0ded8c5db6c7b1c83b3790 /ext/sysvsem
parent33c87b395f805c5402b82c4cbe93532fb29c8c14 (diff)
downloadphp-git-84cd3c125ced37d97f8028f85876964a0d6ab3db.tar.gz
Cleanup code and prevent usage of uninitialized variable.
Diffstat (limited to 'ext/sysvsem')
-rw-r--r--ext/sysvsem/sysvsem.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index a0b4ef2ca7..859f55e4c8 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -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 */
PHP_FUNCTION(sem_get)
{
- long key, max_acquire, perm, auto_release = 1;
+ long key, max_acquire = 1, perm = 0666, auto_release = 1;
int semid;
struct sembuf sop[3];
int count;
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)) {
RETURN_FALSE;
@@ -231,11 +225,7 @@ PHP_FUNCTION(sem_get)
}
/* Get the usage count. */
-#if HAVE_SEMUN
- count = semctl(semid, SYSVSEM_USAGE, GETVAL, un);
-#else
count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
-#endif
if (count == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
}