jerenkrantz 01/07/22 20:28:31
Modified: . CHANGES
locks/unix crossproc.c
Log:
Close file descriptor when we are done with fcntl or flock-based
cross-process locks. Otherwise, we leak descriptors.
This bug rears its ugly head when the SMS locking actually works
(more on that soon).
Revision Changes Path
1.124 +4 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- CHANGES 2001/07/20 13:35:27 1.123
+++ CHANGES 2001/07/23 03:28:30 1.124
@@ -1,5 +1,9 @@
Changes with APR b1
+ *) Close file descriptor when we are done with fcntl or flock-based
+ cross-process lock. Otherwise, we leak descriptors.
+ [Justin Erenkrantz]
+
*) Fix a possible data corruption problem with the use of getpwnam_r() on
all platforms where that function is used.
Use getpwnam_r() and getgrgid_r() instead of getpwnam() and getgrgid()
1.52 +11 -2 apr/locks/unix/crossproc.c
Index: crossproc.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/crossproc.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- crossproc.c 2001/07/19 00:11:57 1.51
+++ crossproc.c 2001/07/23 03:28:30 1.52
@@ -358,11 +358,16 @@
static apr_status_t fcntl_cleanup(void *lock_)
{
+ apr_status_t status;
apr_lock_t *lock=lock_;
if (lock->curr_locked == 1) {
- return fcntl_release(lock);
+ status = fcntl_release(lock);
+ if (status != APR_SUCCESS)
+ return status;
}
+ close(lock->interproc);
+
return APR_SUCCESS;
}
@@ -462,11 +467,15 @@
static apr_status_t flock_cleanup(void *lock_)
{
+ apr_status_t status;
apr_lock_t *lock=lock_;
if (lock->curr_locked == 1) {
- return flock_release(lock);
+ status = flock_release(lock);
+ if (status != APR_SUCCESS)
+ return status;
}
+ close(lock->interproc);
unlink(lock->fname);
return APR_SUCCESS;
}