You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@locus.apache.org on 2000/10/06 19:52:47 UTC

cvs commit: apache-2.0/src/support htpasswd.c

wrowe       00/10/06 10:52:46

  Modified:    src/lib/apr/shmem/unix/mm mm_core.c
               src/lib/apr/threadproc/win32 thread.c
               src/modules/dav/fs repos.c
               src/modules/file_cache cache_util.c file_cache.c
                        file_garbage.c
               src/modules/mpm/prefork prefork.c
               src/modules/standard mod_cern_meta.c mod_cgid.c
               src/support htpasswd.c
  Log:
    Completed review for new tests:
      APR_STATUS_IS_EACCES(s)
      APR_STATUS_IS_EEXIST(s)
      APR_STATUS_IS_ENAMETOOLONG(s)
      APR_STATUS_IS_ENOENT(s)
  
    Where the old EACCES et. al. still exist, we have a problem (not yet
    using APR at all)
  
    More to come...
  
  Revision  Changes    Path
  1.7       +2 -2      apache-2.0/src/lib/apr/shmem/unix/mm/mm_core.c
  
  Index: mm_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/mm/mm_core.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mm_core.c	2000/05/03 17:15:49	1.6
  +++ mm_core.c	2000/10/06 17:52:44	1.7
  @@ -315,14 +315,14 @@
   
   #if defined(MM_SEMT_IPCSEM)
       fdsem = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR);
  -    if (fdsem == -1 && errno == EEXIST)
  +    if (fdsem == -1 && APR_STATUS_IS_EEXIST(errno))
           fdsem = semget(IPC_PRIVATE, 1, IPC_EXCL|S_IRUSR|S_IWUSR);
           if (fdsem == -1)
               FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to acquire semaphore");
       mm_core_semctlarg.val = 0;
       semctl(fdsem, 0, SETVAL, mm_core_semctlarg);
       fdsem_rd = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL|S_IRUSR|S_IWUSR);
  -    if (fdsem_rd == -1 && errno == EEXIST)
  +    if (fdsem_rd == -1 && APR_STATUS_IS_EEXIST(errno))
           fdsem_rd = semget(IPC_PRIVATE, 1, IPC_EXCL|S_IRUSR|S_IWUSR);
           if (fdsem_rd == -1)
               FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to acquire semaphore");
  
  
  
  1.25      +4 -1      apache-2.0/src/lib/apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/win32/thread.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- thread.c	2000/10/06 17:24:41	1.24
  +++ thread.c	2000/10/06 17:52:44	1.25
  @@ -114,7 +114,10 @@
       if (((*new)->td = (HANDLE *)_beginthreadex(NULL, 0, (unsigned int (APR_THREAD_FUNC *)(void *))func,
                                                  data, 0, &temp)) == 0) {
           lasterror = apr_get_os_error();
  -        return APR_EEXIST; /* MSVC++ doc doesn't mention any additional error info */
  +        return APR_EEXIST; 
  +        /* MSVC++ doc doesn't mention any additional error info 
  +         * XXX: need to check the sources
  +         */
       }
   
       if (attr && attr->detach) {
  
  
  
  1.21      +1 -1      apache-2.0/src/modules/dav/fs/repos.c
  
  Index: repos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- repos.c	2000/09/09 23:23:40	1.20
  +++ repos.c	2000/10/06 17:52:44	1.21
  @@ -400,7 +400,7 @@
   
       /* ensure that it exists */
       if (apr_make_dir(dst, APR_OS_DEFAULT, p) != 0) {
  -	if (errno != EEXIST) {
  +	if (APR_STATUS_IS_EEXIST(errno)) {
   	    /* ### use something besides 500? */
   	    return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
   				 "Could not create internal state directory");
  
  
  
  1.6       +3 -3      apache-2.0/src/modules/file_cache/cache_util.c
  
  Index: cache_util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/file_cache/cache_util.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- cache_util.c	2000/09/10 20:45:17	1.5
  +++ cache_util.c	2000/10/06 17:52:45	1.6
  @@ -447,11 +447,11 @@
               break;
           *p = '\0';
   #ifdef WIN32
  -        if (mkdir(file) < 0 && errno != EEXIST)
  +        if (mkdir(file) < 0 && !APR_ERROR_IS_EEXIST(errno))
   #elif defined(__TANDEM)
  -            if (mkdir(file, S_IRWXU | S_IRWXG | S_IRWXO) < 0 && errno != EEXIST)
  +            if (mkdir(file, S_IRWXU | S_IRWXG | S_IRWXO) < 0 && !APR_ERROR_IS_EEXIST(errno))
   #else
  -                if (mkdir(file, S_IREAD | S_IWRITE | S_IEXEC) < 0 && errno != EEXIST)
  +                if (mkdir(file, S_IREAD | S_IWRITE | S_IEXEC) < 0 && !APR_ERROR_IS_EEXIST(errno))
   #endif /* WIN32 */
                       ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
                                    "cache: error creating cache directory %s",
  
  
  
  1.5       +6 -5      apache-2.0/src/modules/file_cache/file_cache.c
  
  Index: file_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/file_cache/file_cache.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- file_cache.c	2000/09/10 20:45:17	1.4
  +++ file_cache.c	2000/10/06 17:52:45	1.5
  @@ -103,11 +103,11 @@
       case AP_CACHE_SEEK:
       {
           apr_file_t *fp = NULL;
  -        apr_status_t ret = APR_ENOENT;
  +        apr_status_t ret;
           char *data = data_file(h, name);
           *el_in = NULL;
  -        if((apr_open(&fp, data, APR_WRITE | APR_READ | APR_BINARY, 0, h->pool)
  -            == APR_SUCCESS))
  +        ret = apr_open(&fp, data, APR_WRITE | APR_READ | APR_BINARY, 0, h->pool);
  +        if (ret == APR_SUCCESS)
           {
               cache_req *cq = create_cache_el(h, name);
               cq->fp = fp;
  @@ -128,8 +128,9 @@
                   }
               }
           }
  -        else if(errno == APR_EACCES)
  -            ap_log_error(APLOG_MARK, APLOG_ERR, 0, h->server,
  +        /* XXX: is this the only case we care to report? */
  +        else if(APR_STATUS_IS_EACCES(ret))
  +            ap_log_error(APLOG_MARK, APLOG_ERR, ret, h->server,
                            "cache: cache entry couldn't be opened, perhaps permission error");
           return ret;
       }
  
  
  
  1.5       +1 -1      apache-2.0/src/modules/file_cache/file_garbage.c
  
  Index: file_garbage.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/file_cache/file_garbage.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- file_garbage.c	2000/08/06 06:07:38	1.4
  +++ file_garbage.c	2000/10/06 17:52:45	1.5
  @@ -308,7 +308,7 @@
               return 0;
           }
           if ((timefd = creat(filename, 0666)) == -1) {
  -            if (errno != EEXIST)
  +            if (!APR_ERROR_IS_EEXIST(errno))
                   ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
                                "cache: creat(%s)", filename);
               else
  
  
  
  1.129     +1 -1      apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- prefork.c	2000/09/08 14:59:33	1.128
  +++ prefork.c	2000/10/06 17:52:45	1.129
  @@ -214,7 +214,7 @@
   	    apr_snprintf(buf, sizeof(buf), "%sgprof.%d", dir, (int)getpid());
   	} 
   	dir = ap_server_root_relative(pconf, buf[0] ? buf : dir);
  -	if(mkdir(dir, 0755) < 0 && errno != EEXIST) {
  +	if(mkdir(dir, 0755) < 0 && !APR_ERROR_IS_EEXIST(errno)) {
   	    ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf,
   			 "gprof: error creating directory %s", dir);
   	}
  
  
  
  1.22      +1 -1      apache-2.0/src/modules/standard/mod_cern_meta.c
  
  Index: mod_cern_meta.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cern_meta.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- mod_cern_meta.c	2000/08/09 20:47:06	1.21
  +++ mod_cern_meta.c	2000/10/06 17:52:46	1.22
  @@ -368,7 +368,7 @@
   
       retcode = apr_open(&f, metafilename, APR_READ | APR_CREATE, APR_OS_DEFAULT, r->pool);
       if (retcode != APR_SUCCESS) {
  -	if (errno == ENOENT) {
  +	if (APR_STATUS_IS_ENOENT(retcode)) {
   	    return DECLINED;
   	}
   	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  
  
  
  1.43      +1 -2      apache-2.0/src/modules/standard/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgid.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- mod_cgid.c	2000/09/22 11:37:05	1.42
  +++ mod_cgid.c	2000/10/06 17:52:46	1.43
  @@ -524,8 +524,7 @@
                          main_server->module_config, &cgid_module); 
   
       apr_signal(SIGCHLD, SIG_IGN); 
  -    if (unlink(sconf->sockname) < 0 &&
  -        errno != ENOENT) {
  +    if (unlink(sconf->sockname) < 0 && errno == ENOENT) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
                        "Couldn't unlink unix domain socket %s",
                        sconf->sockname);
  
  
  
  1.22      +2 -2      apache-2.0/src/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htpasswd.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- htpasswd.c	2000/08/07 19:26:02	1.21
  +++ htpasswd.c	2000/10/06 17:52:46	1.22
  @@ -335,10 +335,10 @@
   static int exists(char *fname)
   {
       apr_finfo_t sbuf;
  -    int check;
  +    apr_status_t check;
   
       check = apr_stat(&sbuf, fname, NULL);
  -    return ((check == -1) && (errno == ENOENT)) ? 0 : 1;
  +    return (check ? 0 : 1);
   }
   
   /*
  
  
  

Re: cvs commit: apache-2.0/src/support htpasswd.c

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Oct 06, 2000 at 03:20:35PM -0500, William A. Rowe, Jr. wrote:
>...
> And thanks for catching that bleck-up, Greg.

No problem... but I bungled too :-) ... there were some unrelated changes
pending that got caught up in that commit. I'm not going to back out that
portion (for now) cuz I'll have the rest of the thing in RSN.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

RE: cvs commit: apache-2.0/src/support htpasswd.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
We know why I bungled that however (and was about to change it
over to apr semantics.)  So I recant any implication that the
current location is vetoed... but I'm still not terribly happy
that it its significance could be lost.

And thanks for catching that bleck-up, Greg.



Re: cvs commit: apache-2.0/src/support htpasswd.c

Posted by Greg Stein <gs...@lyra.org>.
+1 on the current location. It makes sense.

On Fri, Oct 06, 2000 at 11:18:02AM -0700, rbb@covalent.net wrote:
> On Fri, 6 Oct 2000, William A. Rowe, Jr. wrote:
> > Thanks...  I'm trying to avoid legit use of errno/old values.
> > That slipped by.
> > 
> > I have a simple question, what the *heck* is it doig in lib/apr!?!
> > 
> > I'd veto that placement instantly - if you want to maintain a
> > library with it's official distro, it belongs rooted straight
> > out of lib/
> > 
> > I'm not against Ralf's mm - just where it was put.
> 
> But it's not an Apache lib, it's an APR lib.  And, it's only used on Unix
> machines.  Putting it under lib makes sense if Apache were ever going to
> use it directly, it's not.  MM is not portable to non-Unix platforms.
> 
> We could put it in apr/lib, but that was historically used for other
> things, and the shmem/unix position made the most sense when I added it.
> 
> Ryan

-- 
Greg Stein, http://www.lyra.org/

RE: cvs commit: apache-2.0/src/support htpasswd.c

Posted by rb...@covalent.net.
On Fri, 6 Oct 2000, William A. Rowe, Jr. wrote:

> One alternative, create a path src/lib/apr/??? (can't be lib unless
> you care to move apr_pools.c/apr_symbols.c somewhere else) for libs 
> that apr uses, but shouldn't expose to the apache sources.

Yeah......  But, APR shouldn't have many libs at all, because it is a
library itself, and I dislike the idea of putting too many dependancies in
it.  MM makes sense, because it is a very useful abstraction.  We could
make lib/apr/libs, but does that really make sense?  If a lib works on all
platforms, then it is likely to be either not included in APR, or a
separate directory off lib/apr itself.  If a lib only works on a couple of
platforms, I think it makes sense to put it under those platforms
directly.

I am perfectly willing to be convinced, but I do kind of like where MM is
now.  It says that for sure, only platforms that use the Unix code need to
worry about MM.  If MM is under lib/apr/libs, new contributors may get
confused, and believe they have to port MM to their platform, when all
they have to do is port the current shm interface.

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


RE: cvs commit: apache-2.0/src/support htpasswd.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
One alternative, create a path src/lib/apr/??? (can't be lib unless
you care to move apr_pools.c/apr_symbols.c somewhere else) for libs 
that apr uses, but shouldn't expose to the apache sources.

> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> Sent: Friday, October 06, 2000 1:11 PM
> 
> Thanks...  I'm trying to avoid legit use of errno/old values.
> That slipped by.
> 
> I have a simple question, what the *heck* is it doig in lib/apr!?!
> 
> I'd veto that placement instantly - if you want to maintain a
> library with it's official distro, it belongs rooted straight
> out of lib/
> 
> I'm not against Ralf's mm - just where it was put.
> 
> Bill
> 
> > From: rbb@covalent.net [mailto:rbb@covalent.net]
> > Sent: Friday, October 06, 2000 12:59 PM
> > 
> > On 6 Oct 2000 wrowe@locus.apache.org wrote:
> > 
> > > wrowe       00/10/06 10:52:46
> > > 
> > >   Modified:    src/lib/apr/shmem/unix/mm mm_core.c
> > 
> > We don't want to add APR to anything in 
> > src/lib/apr/shmem/unix/mm.  The
> > reason is that is an external project that does not use APR.  
> > Those errno
> > values are correct as they were.  Can we please back out 
> those changes
> > only.
> > 
> > Ryan
> > 
> > 
> > ______________________________________________________________
> > _________________
> > Ryan Bloom                        	rbb@apache.org
> > 406 29th St.
> > San Francisco, CA 94131
> > --------------------------------------------------------------
> > -----------------
> > 
> > 
> 

RE: cvs commit: apache-2.0/src/support htpasswd.c

Posted by rb...@covalent.net.
On Fri, 6 Oct 2000, William A. Rowe, Jr. wrote:

> Thanks...  I'm trying to avoid legit use of errno/old values.
> That slipped by.
> 
> I have a simple question, what the *heck* is it doig in lib/apr!?!
> 
> I'd veto that placement instantly - if you want to maintain a
> library with it's official distro, it belongs rooted straight
> out of lib/
> 
> I'm not against Ralf's mm - just where it was put.


But it's not an Apache lib, it's an APR lib.  And, it's only used on Unix
machines.  Putting it under lib makes sense if Apache were ever going to
use it directly, it's not.  MM is not portable to non-Unix platforms.

We could put it in apr/lib, but that was historically used for other
things, and the shmem/unix position made the most sense when I added it.

Ryan


> 
> Bill
> 
> > -----Original Message-----
> > From: rbb@covalent.net [mailto:rbb@covalent.net]
> > Sent: Friday, October 06, 2000 12:59 PM
> > To: new-httpd@apache.org
> > Cc: apache-2.0-cvs@apache.org
> > Subject: Re: cvs commit: apache-2.0/src/support htpasswd.c
> > 
> > 
> > 
> > 
> > 
> > On 6 Oct 2000 wrowe@locus.apache.org wrote:
> > 
> > > wrowe       00/10/06 10:52:46
> > > 
> > >   Modified:    src/lib/apr/shmem/unix/mm mm_core.c
> > 
> > We don't want to add APR to anything in 
> > src/lib/apr/shmem/unix/mm.  The
> > reason is that is an external project that does not use APR.  
> > Those errno
> > values are correct as they were.  Can we please back out those changes
> > only.
> > 
> > Ryan
> > 
> > 
> > ______________________________________________________________
> > _________________
> > Ryan Bloom                        	rbb@apache.org
> > 406 29th St.
> > San Francisco, CA 94131
> > --------------------------------------------------------------
> > -----------------
> > 
> > 
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


RE: cvs commit: apache-2.0/src/support htpasswd.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Thanks...  I'm trying to avoid legit use of errno/old values.
That slipped by.

I have a simple question, what the *heck* is it doig in lib/apr!?!

I'd veto that placement instantly - if you want to maintain a
library with it's official distro, it belongs rooted straight
out of lib/

I'm not against Ralf's mm - just where it was put.

Bill

> -----Original Message-----
> From: rbb@covalent.net [mailto:rbb@covalent.net]
> Sent: Friday, October 06, 2000 12:59 PM
> To: new-httpd@apache.org
> Cc: apache-2.0-cvs@apache.org
> Subject: Re: cvs commit: apache-2.0/src/support htpasswd.c
> 
> 
> 
> 
> 
> On 6 Oct 2000 wrowe@locus.apache.org wrote:
> 
> > wrowe       00/10/06 10:52:46
> > 
> >   Modified:    src/lib/apr/shmem/unix/mm mm_core.c
> 
> We don't want to add APR to anything in 
> src/lib/apr/shmem/unix/mm.  The
> reason is that is an external project that does not use APR.  
> Those errno
> values are correct as they were.  Can we please back out those changes
> only.
> 
> Ryan
> 
> 
> ______________________________________________________________
> _________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> --------------------------------------------------------------
> -----------------
> 
> 

Re: cvs commit: apache-2.0/src/support htpasswd.c

Posted by rb...@covalent.net.


On 6 Oct 2000 wrowe@locus.apache.org wrote:

> wrowe       00/10/06 10:52:46
> 
>   Modified:    src/lib/apr/shmem/unix/mm mm_core.c

We don't want to add APR to anything in src/lib/apr/shmem/unix/mm.  The
reason is that is an external project that does not use APR.  Those errno
values are correct as they were.  Can we please back out those changes
only.

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/support htpasswd.c

Posted by rb...@covalent.net.


On 6 Oct 2000 wrowe@locus.apache.org wrote:

> wrowe       00/10/06 10:52:46
> 
>   Modified:    src/lib/apr/shmem/unix/mm mm_core.c

We don't want to add APR to anything in src/lib/apr/shmem/unix/mm.  The
reason is that is an external project that does not use APR.  Those errno
values are correct as they were.  Can we please back out those changes
only.

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------