You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/02/23 21:29:08 UTC

cvs commit: apr/locks/unix crossproc.c

trawick     01/02/23 12:29:08

  Modified:    include/arch/unix fileio.h
               file_io/unix mktemp.c
               locks/unix crossproc.c
  Log:
  change mkstemp() to apr_mkstemp() so we don't pollute somebody else's
  namespace
  
  apr_mkstemp() is only intended to be used within the Unix APR
  implementation; a similar function but with an appropriate APR interface
  would be nice to support cross-platform
  
  Revision  Changes    Path
  1.32      +2 -0      apr/include/arch/unix/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/fileio.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- fileio.h	2001/02/16 04:15:51	1.31
  +++ fileio.h	2001/02/23 20:29:07	1.32
  @@ -149,5 +149,7 @@
   mode_t apr_unix_perms2mode(apr_fileperms_t perms);
   apr_fileperms_t apr_unix_mode2perms(mode_t mode);
   
  +int apr_mkstemp(char *template);
  +
   #endif  /* ! FILE_IO_H */
   
  
  
  
  1.4       +16 -3     apr/file_io/unix/mktemp.c
  
  Index: mktemp.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/mktemp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mktemp.c	2001/02/23 18:35:42	1.3
  +++ mktemp.c	2001/02/23 20:29:07	1.4
  @@ -32,6 +32,7 @@
    */
   
   #include "apr_private.h"
  +#include "fileio.h" /* prototype of apr_mkstemp() */
   
   #if !defined(HAVE_MKSTEMP)
   
  @@ -92,9 +93,7 @@
   }
   #endif /* APR_STARTS_USING_IT */
   
  -int
  -mkstemp(path)
  -	char *path;
  +int apr_mkstemp(char *path)
   {
   	int fd;
   
  @@ -218,6 +217,20 @@
   		}
   	}
   	/*NOTREACHED*/
  +}
  +
  +#else
  +
  +#if APR_HAVE_STDLIB_H
  +#include <stdlib.h> /* for mkstemp() - Single Unix */
  +#endif
  +#if APR_HAVE_UNISTD_H
  +#include <unistd.h> /* for mkstemp() - FreeBSD */
  +#endif
  +
  +int apr_mkstemp(char *template)
  +{
  +    return mkstemp(template);
   }
   
   #endif /* !defined(HAVE_MKSTEMP) */
  
  
  
  1.42      +3 -2      apr/locks/unix/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/crossproc.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- crossproc.c	2001/02/16 04:15:55	1.41
  +++ crossproc.c	2001/02/23 20:29:07	1.42
  @@ -55,6 +55,7 @@
   #include "apr.h"
   #include "apr_strings.h"
   #include "locks.h"
  +#include "fileio.h" /* for apr_mkstemp() */
   
   #if APR_USE_SYSVSEM_SERIALIZE  
   
  @@ -305,7 +306,7 @@
       }
       else {
           new->fname = apr_pstrdup(new->cntxt, "/tmp/aprXXXXXX"); 
  -        new->interproc = mkstemp(new->fname);
  +        new->interproc = apr_mkstemp(new->fname);
       }
   
       if (new->interproc < 0) {
  @@ -387,7 +388,7 @@
       }
       else {
           new->fname = apr_pstrdup(new->cntxt, "/tmp/aprXXXXXX"); 
  -        new->interproc = mkstemp(new->fname);
  +        new->interproc = apr_mkstemp(new->fname);
       }
   
       if (new->interproc < 0) {