Looks good, but it doesn't unlink() the opened file.
Do we still want that feature?
The #include <stdlib.h> is superfluous. The include of "locks.h" will
cover that. (Ryan added stdlib in there)
Cheers,
-g
On Fri, 2 Jun 2000, Jeff Trawick wrote:
>...
> I think a patch like this would solve it:
>
> (not tested, but that never stopped anybody from posting or committing
> code :) )
>
> (seriously, I don't mind testing it, but I imagine that Ryan is
> playing with it now... Ryan, let me know if I should verify and
> commit; Greg will certainly speak up if it is obviously FUBAR)
>
> Index: src/lib/apr/locks/unix/crossproc.c
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/lib/apr/locks/unix/crossproc.c,v
> retrieving revision 1.27
> diff -u -r1.27 crossproc.c
> --- crossproc.c 2000/04/14 15:58:30 1.27
> +++ crossproc.c 2000/06/03 02:07:24
> @@ -53,6 +53,7 @@
> */
>
> #include "locks.h"
> +#include <stdlib.h>
>
> #if defined (USE_SYSVSEM_SERIALIZE)
>
> @@ -269,7 +270,13 @@
>
> ap_status_t ap_unix_create_inter_lock(ap_lock_t *new)
> {
> - new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
> + if (new->fname) {
> + new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
> + }
> + else {
> + new->fname = ap_pstrdup(new->cntxt, "/tmp/aprXXXXXX");
> + new->interproc = mkstemp(new->fname);
> + }
>
> if (new->interproc < 0) {
> lock_cleanup(new);
> @@ -338,7 +345,13 @@
>
> ap_status_t ap_unix_create_inter_lock(ap_lock_t *new)
> {
> - new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0600);
> + if (new->fname) {
> + new->interproc = open(new->fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
> + }
> + else {
> + new->fname = ap_pstrdup(new->cntxt, "/tmp/aprXXXXXX");
> + new->interproc = mkstemp(new->fname);
> + }
>
> if (new->interproc < 0) {
> lock_cleanup(new);
> Index: src/lib/apr/locks/unix/locks.c
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/lib/apr/locks/unix/locks.c,v
> retrieving revision 1.32
> diff -u -r1.32 locks.c
> --- locks.c 2000/06/03 00:31:13 1.32
> +++ locks.c 2000/06/03 02:07:24
> @@ -73,12 +73,6 @@
> if (fname != NULL) {
> new->fname = ap_pstrdup(cont, fname);
> }
> - else {
> - char *filename = "/tmp/aprXXXXXX";
> - new->interproc = mkstemp(filename);
> - new->fname = ap_pstrdup(cont, filename);
> - unlink(new->fname);
> - }
> }
> #endif
>
>
>
>
> --
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
> http://www.geocities.com/SiliconValley/Park/9289/
> Born in Roswell... married an alien...
>
--
Greg Stein, http://www.lyra.org/
|