diff options
author | Gavin Sherry <swm@php.net> | 2001-05-15 07:32:34 +0000 |
---|---|---|
committer | Gavin Sherry <swm@php.net> | 2001-05-15 07:32:34 +0000 |
commit | 3a677d3e2088c1913440032323efd137f94d86e7 (patch) | |
tree | 259fca0d5249390a9a2cc7f31c3ad1d93a7fb7cf /ext | |
parent | 16a13a6210624a1b3075d84835a1ddbb21f589cb (diff) | |
download | php-git-3a677d3e2088c1913440032323efd137f94d86e7.tar.gz |
fixed shm_remove to expect the correct argument.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/sysvshm/sysvshm.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index b89bdea819..874bbd7b1c 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -18,7 +18,9 @@ /* $Id$ */ -/* This has been built and tested on Solaris 2.6. +/* This has been built and tested on Linux 2.2.14 + * + * This has been built and tested on Solaris 2.6. * It may not compile or execute correctly on other systems. */ @@ -173,26 +175,25 @@ PHP_FUNCTION(shm_detach) /* }}} */ /* {{{ proto int shm_remove(int shm_identifier) Removes shared memory from Unix systems */ + PHP_FUNCTION(shm_remove) { - pval **arg_key; + pval **arg_id; long id; - key_t key; + int type; + sysvshm_shm *shm_list_ptr; - if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_key) == FAILURE) { + if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) { WRONG_PARAM_COUNT; } - convert_to_long_ex(arg_key); + convert_to_long_ex(arg_id); - key = (*arg_key)->value.lval; + id = (*arg_id)->value.lval; - if((id=shmget(key,0,0))<0) { - php_error(E_WARNING, "%d is not a existing SysV shared memory key", key); - RETURN_FALSE; - } - if(shmctl(id,IPC_RMID,NULL)<0) { - php_error(E_WARNING, "shm_remove() failed for key 0x%x: %s", key, strerror(errno)); + shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); + if(shmctl(shm_list_ptr->id,IPC_RMID,NULL)<0) { + php_error(E_WARNING, "shm_remove() failed for key 0x%x, id %i: %s", shm_list_ptr->key, id,strerror(errno)); RETURN_FALSE; } |