PS. I haven't tested the lock file mod but it should work.
*** src/ocspd/src/server.c 2005-07-14 17:13:54.612191015 +1000
--- src/ocspd/src/server.c.dist 2005-07-13 17:04:06.000000000 +1000
***************
*** 14,20 ****
#include <netinet/in.h>
#include <resolv.h>
#include <unistd.h>
- #include <stdlib.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
--- 14,19 ----
***************
*** 40,47 ****
/* If this is true =1 then we should stop spawning processes */
static int stop_server = 0;
- static char lck_template[] = "/tmp/ocsp.lck.XXXXXX";
-
int start_server( char *bind_s, char *port_s, int max_ch_num,
int queue, long max_size, OCSPD_CONFIG *ocspd_conf ) {
--- 39,44 ----
***************
*** 94,108 ****
#ifdef _USE_FLOCK
/* We need a file descriptor to make locks on it */
! /* if( (lck = open("/tmp/ocsp.lck", O_CREAT )) == 0 ) { */
! if( (lck = mkstemp(lck_template)) == 0) {
syslog(LOG_ERR, "Impossible to open flock file");
return 0;
}
#endif
#ifdef _USE_SEMAPHORES
/* Let's create the semaphore and check it */
! my_key = ftok(".", 3560+getpid());
lck = semget( my_key, 1, IPC_CREAT | IPC_EXCL | 0600 );
options.val = 1;
semctl( lck, 0, SETVAL, options);
--- 91,104 ----
#ifdef _USE_FLOCK
/* We need a file descriptor to make locks on it */
! if( (lck = open("/tmp/ocsp.lck", O_CREAT )) == 0 ) {
syslog(LOG_ERR, "Impossible to open flock file");
return 0;
}
#endif
#ifdef _USE_SEMAPHORES
/* Let's create the semaphore and check it */
! my_key = ftok(".", 3560);
lck = semget( my_key, 1, IPC_CREAT | IPC_EXCL | 0600 );
options.val = 1;
semctl( lck, 0, SETVAL, options);
***************
*** 427,433 ****
if( lck > 0 ) {
#ifdef _USE_FLOCK
close(lck);
- unlink(lck_template);
#endif
#ifdef _USE_SEMAPHORES
semctl(lck, 0, IPC_RMID, 0);
--- 423,428 ----
--
Dr. Rodney G. McDuff |Ex ignorantia ad sapientiam
Manager, Strategic Technologies Group| Ex luce ad tenebras
Information Technology Services |
The University of Queensland |
EMAIL: [EMAIL PROTECTED] |
TELEPHONE: +61 7 3365 8220 |
signature.asc
Description: OpenPGP digital signature
