pgpool2.git / summary / log / commit / refs

commit    33130f82c10fa98c4e1091d0319545355e805d76
Author:   Yoshiyuki Asaba <y-asaba at pgfoundry.org>
Date:     Wed Sep 26 03:32:14 2007 +0000

    Fix initializing semaphore values.


pool_sema.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pool_sema.c b/pool_sema.c index 075759c4e..b39c74f60 100644 --- a/pool_sema.c +++ b/pool_sema.c @@ -75,7 +75,7 @@ IpcSemaphoreKill(int status, Datum semId) int pool_semaphore_create(int numSems) { - int semNum; + int i; /* Try to create new semaphore set */ semId = semget(IPC_PRIVATE, numSems, IPC_CREAT | IPC_EXCL | IPCProtection); @@ -89,15 +89,15 @@ pool_semaphore_create(int numSems) on_shmem_exit(IpcSemaphoreKill, semId); /* Initialize it to count 1 */ - for (semNum = 0; semNum < MAX_NUM_SEMAPHORES; semNum++) + for (i = 0; i < numSems; i++) { union semun semun; semun.val = 1; - if (semctl(semId, 0, SETVAL, semun) < 0) + if (semctl(semId, i, SETVAL, semun) < 0) { pool_error("semctl(%d, %d, SETVAL, %d) failed: %s", - semId, semNum, 1); + semId, i, 1); return -1; } } [parent: c4e85b5acb55]