cvs commit: apache-2.0/src/lib/apr/file_io/unix dir.c

1999-10-31 Thread rse
rse 99/10/31 08:18:36

  Modified:src/lib/apr/time/unix time.c
   src/lib/apr/file_io/unix dir.c
  Log:
  Be careful, _POSIX_THREAD_SAFE_FUNCTIONS is a feature test macro, yes, but it
  works by being either defined or not. It's not always defined and just has a
  value 0 or not 0...
  
  Revision  ChangesPath
  1.11  +2 -2  apache-2.0/src/lib/apr/time/unix/time.c
  
  Index: time.c
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/time.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- time.c1999/10/19 19:21:22 1.10
  +++ time.c1999/10/31 16:18:35 1.11
  @@ -107,7 +107,7 @@
   {
   switch (type) {
   case APR_LOCALTIME: {
  -#if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
   localtime_r(&atime->currtime->tv_sec, atime->explodedtime);
   #else
   atime->explodedtime = localtime(&atime->currtime->tv_sec);
  @@ -115,7 +115,7 @@
   break;
   }
   case APR_UTCTIME: {
  -#if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
   gmtime_r(&atime->currtime->tv_sec, atime->explodedtime);
   #else
   atime->explodedtime = gmtime(&atime->currtime->tv_sec);
  
  
  
  1.14  +1 -1  apache-2.0/src/lib/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- dir.c 1999/10/23 21:23:20 1.13
  +++ dir.c 1999/10/31 16:18:36 1.14
  @@ -124,7 +124,7 @@
*/
   ap_status_t ap_readdir(struct dir_t *thedir)
   {
  -#if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
   ap_status_t ret;
   ret = readdir_r(thedir->dirstruct, thedir->entry, &thedir->entry);
   /* Avoid the Linux problem where at end-of-directory thedir->entry
  
  
  


cvs commit: apache-2.0/src/main util_script.c

1999-10-31 Thread bjh
bjh 99/10/31 01:26:04

  Modified:src/modules/standard mod_asis.c
   src/include util_script.h
   src/main util_script.c
  Log:
  Eliminate use of FILE * & ap_get_os_file() in mod_asis by APRizing
  ap_scan_script_header_err().
  
  Revision  ChangesPath
  1.11  +1 -8  apache-2.0/src/modules/standard/mod_asis.c
  
  Index: mod_asis.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_asis.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- mod_asis.c1999/10/20 12:50:07 1.10
  +++ mod_asis.c1999/10/31 09:26:00 1.11
  @@ -68,8 +68,6 @@
   ap_file_t *f;
   ap_status_t status;
   const char *location;
  -FILE *thefile; /* XXX leave these alone until we convert */
  -int thefd; /* everything to use apr_file_t's. */ 
   
   r->allowed |= (1 << M_GET);
   if (r->method_number != M_GET)
  @@ -87,10 +85,7 @@
return FORBIDDEN;
   }
   
  -ap_get_os_file(&thefd, f); 
  -thefile = fdopen(thefd, "r");
  -
  -ap_scan_script_header_err(r, thefile, NULL);
  +ap_scan_script_header_err(r, f, NULL);
   location = ap_table_get(r->headers_out, "Location");
   
   if (location && location[0] == '/' &&
  @@ -113,8 +108,6 @@
   
   ap_send_http_header(r);
   if (!r->header_only) {
  -ap_off_t zero = 0;
  - ap_seek(f, APR_CUR, &zero);
ap_send_fd(f, r);
   }
   
  
  
  
  1.4   +1 -1  apache-2.0/src/include/util_script.h
  
  Index: util_script.h
  ===
  RCS file: /home/cvs/apache-2.0/src/include/util_script.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- util_script.h 1999/10/24 19:23:43 1.3
  +++ util_script.h 1999/10/31 09:26:03 1.4
  @@ -74,7 +74,7 @@
   API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info);
   API_EXPORT(void) ap_add_cgi_vars(request_rec *r);
   API_EXPORT(void) ap_add_common_vars(request_rec *r);
  -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char 
*buffer);
  +API_EXPORT(int) ap_scan_script_header_err(request_rec *r, ap_file_t *f, char 
*buffer);
   API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f,
  char *buffer);
   API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
  
  
  
  1.17  +2 -2  apache-2.0/src/main/util_script.c
  
  Index: util_script.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/util_script.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- util_script.c 1999/10/31 09:02:54 1.16
  +++ util_script.c 1999/10/31 09:26:03 1.17
  @@ -605,10 +605,10 @@
   
   static int getsfunc_FILE(char *buf, int len, void *f)
   {
  -return fgets(buf, len, (FILE *) f) != NULL;
  +return ap_fgets(buf, len, (ap_file_t *) f) == APR_SUCCESS;
   }
   
  -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f,
  +API_EXPORT(int) ap_scan_script_header_err(request_rec *r, ap_file_t *f,
  char *buffer)
   {
   return ap_scan_script_header_err_core(r, buffer, getsfunc_FILE, f);
  
  
  


cvs commit: apache-2.0/src/main buff.c

1999-10-31 Thread bjh
bjh 99/10/31 01:16:40

  Modified:src/main buff.c
  Log:
  Fix chunking, end_chunk() wasn't being called.
  
  Revision  ChangesPath
  1.24  +1 -1  apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- buff.c1999/10/31 09:13:22 1.23
  +++ buff.c1999/10/31 09:16:40 1.24
  @@ -301,7 +301,7 @@
   else {
fb->flags &= ~flag;
/* stop chunking if we haven't already */
  -if ((flag ^ old_flags) & B_CHUNK) {
  +if (flag & old_flags & B_CHUNK) {
   end_chunk(fb, 0);
   }
   }
  
  
  


cvs commit: apache-2.0/src/main buff.c http_protocol.c

1999-10-31 Thread manoj
manoj   99/10/31 01:13:23

  Modified:src  CHANGES
   src/include buff.h
   src/main buff.c http_protocol.c
  Log:
  Finish removing references to errno from buff, by introducing
  ap_berror() to return the status from calls that don't return an
  ap_status_t.
  
  Revision  ChangesPath
  1.16  +2 -2  apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -d -u -r1.15 -r1.16
  --- CHANGES   1999/10/30 02:06:31 1.15
  +++ CHANGES   1999/10/31 09:13:20 1.16
  @@ -1,7 +1,7 @@
   Changes with Apache 2.0-dev
   
  -  *) Large sections of buff, including the APIs, have been converted to
  - no longer use errno. [Manoj Kasichainula]
  +  *) buff.c has been converted to no longer use errno.
  + [Manoj Kasichainula]
   
 *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and
interface adaption to APR functions did it. [Martin Kraemer]
  
  
  
  1.11  +6 -0  apache-2.0/src/include/buff.h
  
  Index: buff.h
  ===
  RCS file: /home/cvs/apache-2.0/src/include/buff.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -d -u -r1.10 -r1.11
  --- buff.h1999/10/31 09:02:52 1.10
  +++ buff.h1999/10/31 09:13:21 1.11
  @@ -129,6 +129,11 @@
   struct buff_struct {
   int flags;   /* flags */
   ap_status_t saved_errno; /* saved errno */
  +ap_status_t berrno; /* errno for the functions that don't return
  +   an ap_status_t. This is separate from
  +   saved_errno. A broken call, e.g. ap_bgets
  +   on an unbuffered stream, shouldn't change
  +   the saved error from I/O */
   unsigned char *inptr;/* pointer to next location to read */
   int incnt;   /* number of bytes left to read from 
input buffer;
 * always 0 if had a read error  */
  @@ -180,6 +185,7 @@
   API_EXPORT(void) ap_bonerror(BUFF *fb,
void (*error) (BUFF *, int, void *, 
ap_status_t),
void *data);
  +API_EXPORT(ap_status_t) ap_berror(BUFF *fb);
   
   /* I/O */
   API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte,
  
  
  
  1.23  +22 -13apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -d -u -r1.22 -r1.23
  --- buff.c1999/10/31 09:02:53 1.22
  +++ buff.c1999/10/31 09:13:22 1.23
  @@ -55,14 +55,10 @@
*
*/
   
  -/* TODO: Everything involving errno in here is a hack to manage the
  - * transition from errnohood to nonerrnohood - manoj */
  -
   #include "httpd.h"
   #include "http_main.h"
   #include "http_log.h"
   
  -#include 
   #include 
   #include 
   #include 
  @@ -210,6 +206,7 @@
}
return iol_setopt(fb->iol, AP_IOL_TIMEOUT, optval);
   }
  +fb->berrno = APR_EINVAL;
   return APR_EINVAL;
   }
   
  @@ -228,6 +225,7 @@
   case BO_TIMEOUT:
return iol_getopt(fb->iol, AP_IOL_TIMEOUT, optval);
   }
  +fb->berrno = APR_EINVAL;
   return APR_EINVAL;
   }
   
  @@ -322,6 +320,7 @@
fb->flags |= B_EOF;
   }
   else if (rv != APR_SUCCESS) {
  + fb->berrno = rv;
fb->saved_errno = rv;
if (rv != APR_EAGAIN) {
doerror(fb, B_RD);
  @@ -447,11 +446,10 @@
   
   /* Can't do bgets on an unbuffered stream */
   if (!(fb->flags & B_RD)) {
  - errno = EINVAL;
  + fb->berrno = APR_EINVAL;
return -1;
   }
   if (fb->flags & B_RDERR) {
  - errno = fb->saved_errno;
return -1;
   }
   
  @@ -466,7 +464,6 @@
break;
rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i);
if (rv != APR_SUCCESS) {
  -errno = rv;
buff[ct] = '\0';
return ct ? ct : -1;
}
  @@ -537,7 +534,6 @@
   if (rv == APR_SUCCESS) {
   return bytes_written;
   }
  -errno = rv;
   return -1;
   }
   
  @@ -552,7 +548,7 @@
   
   rv = ap_bread(fb, buf, 1, &i);
   if (rv == APR_SUCCESS && i == 0)
  - errno = 0;  /* no error; EOF */
  +fb->berrno = APR_SUCCESS;   /* no error; EOF */
   if (i != 1)
return EOF;
   else
  @@ -837,6 +833,7 @@
   ap_ssize_t n;   /* Placeholder; not ever used */
   
   if ((fb->flags & (B_EOUT | B_WR)) != B_WR) {
  +fb->berrno = APR_EINVAL;
   return APR_EINVAL;
   }
   if 

cvs commit: apache-2.0/src/modules/standard mod_cgi.c

1999-10-31 Thread manoj
manoj   99/10/31 01:02:57

  Modified:src/include buff.h
   src/main buff.c http_protocol.c util_script.c
   src/modules/standard mod_cgi.c
  Log:
  Undo the ap_bgets errno patch. It will return status with ap_berror().
  
  Revision  ChangesPath
  1.10  +1 -2  apache-2.0/src/include/buff.h
  
  Index: buff.h
  ===
  RCS file: /home/cvs/apache-2.0/src/include/buff.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -d -u -r1.9 -r1.10
  --- buff.h1999/10/30 08:05:07 1.9
  +++ buff.h1999/10/31 09:02:52 1.10
  @@ -184,8 +184,7 @@
   /* I/O */
   API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte,
ap_ssize_t *bytes_read);
  -API_EXPORT(ap_status_t) ap_bgets(char *s, int n, BUFF *fb,
  - ap_ssize_t *bytes_read);
  +API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb);
   API_EXPORT(int) ap_blookc(BUFF *fb);
   API_EXPORT(ap_status_t) ap_bwrite(BUFF *fb, const void *buf, ap_size_t nbyte,
 ap_ssize_t *bytes_written);
  
  
  
  1.22  +10 -21apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -d -u -r1.21 -r1.22
  --- buff.c1999/10/30 08:05:08 1.21
  +++ buff.c1999/10/31 09:02:53 1.22
  @@ -429,11 +429,8 @@
* read, it is replaced by a newline character.  The string is then
* terminated with a null character.
*
  - * Works a little differently than the other BUFF functions, returning
  - * APR_EOF on end-of-file instead of just setting bytes_read = 0,
  - * because it makes code simpler.
  - *
  - * XXX - I'm undecided on keeping this function inconsistent - manoj
  + * Returns the number of bytes stored in buff, or zero on end of
  + * transmission, or -1 on an error.
*
* Notes:
*  If null characters are expected in the data stream, then
  @@ -443,20 +440,19 @@
*  CR characters in the byte stream not immediately followed by a LF
* will be preserved.
*/
  -API_EXPORT(ap_status_t) ap_bgets(char *buff, int n, BUFF *fb,
  - ap_ssize_t *bytes_read)
  +API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb)
   {
   int i, ch, ct;
   ap_status_t rv;
   
   /* Can't do bgets on an unbuffered stream */
   if (!(fb->flags & B_RD)) {
  -*bytes_read = 0;
  - return APR_EINVAL;
  + errno = EINVAL;
  + return -1;
   }
   if (fb->flags & B_RDERR) {
  -*bytes_read = 0;
  - return fb->saved_errno;
  + errno = fb->saved_errno;
  + return -1;
   }
   
   ct = 0;
  @@ -470,13 +466,9 @@
break;
rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i);
if (rv != APR_SUCCESS) {
  +errno = rv;
buff[ct] = '\0';
  -*bytes_read = ct;
  -#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH
  -return rv;
  -#else
  - return *bytes_read ? APR_SUCCESS : rv;
  -#endif
  + return ct ? ct : -1;
}
fb->incnt = i;
if (i == 0)
  @@ -509,10 +501,7 @@
   fb->inptr += i;
   
   buff[ct] = '\0';
  -*bytes_read = ct;
  -if (i == 0)
  -return APR_EOF;
  -return APR_SUCCESS;
  +return ct;
   }
   
   /*
  
  
  
  1.30  +10 -11apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -d -u -r1.29 -r1.30
  --- http_protocol.c   1999/10/30 08:05:08 1.29
  +++ http_protocol.c   1999/10/31 09:02:53 1.30
  @@ -674,24 +674,23 @@
   static int getline(char *s, int n, BUFF *in, int fold)
   {
   char *pos, next;
  -ap_status_t retval;
  -ap_ssize_t nbytes;
  +int retval;
   int total = 0;
   
   pos = s;
   
   do {
  -retval = ap_bgets(pos, n, in, &nbytes);
  -   /* retval == APR_EOF if EOF, normal error codes otherwise */
  +retval = ap_bgets(pos, n, in);
  +   /* retval == -1 if error, 0 if EOF */
   
  -if (retval != APR_SUCCESS)/* error or eof */
  -return ((retval != APR_EOF) && (total == 0)) ? -1 : total;
  +if (retval <= 0)
  +return ((retval < 0) && (total == 0)) ? -1 : total;
   
  -/* nbytes is the number of characters read, not including NUL  */
  +/* retval is the number of characters read, not including NUL  */
   
  -n -= nbytes;/* Keep track of how much of s is full */
  -pos += (nbytes - 1);/* and where s ends  

cvs commit: apache-2.0/src/os/os2 iol_socket.c

1999-10-31 Thread bjh
bjh 99/10/30 23:13:18

  Modified:src/os/os2 iol_socket.c
  Log:
  OS/2: iol_socket cleanup
  - method functions should be static.
  - errno is no longer relevant.
  
  Revision  ChangesPath
  1.6   +4 -10 apache-2.0/src/os/os2/iol_socket.c
  
  Index: iol_socket.c
  ===
  RCS file: /home/cvs/apache-2.0/src/os/os2/iol_socket.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- iol_socket.c  1999/10/29 15:06:22 1.5
  +++ iol_socket.c  1999/10/31 06:13:14 1.6
  @@ -62,7 +62,6 @@
   #include 
   #include 
   
  -#include 
   #include 
   #include 
   
  @@ -97,18 +96,18 @@
   return APR_SUCCESS;
   }
   
  -ap_status_t os2_write(ap_iol *viol, const char *buf, ap_size_t size, 
ap_ssize_t *nbytes)
  +static ap_status_t os2_write(ap_iol *viol, const char *buf, ap_size_t size, 
ap_ssize_t *nbytes)
   {
   *nbytes = size;
   return ap_send(((iol_socket *)viol)->sock, buf, nbytes);
   }
   
  -ap_status_t os2_writev(ap_iol *viol, const struct iovec *vec, int nvec, 
ap_ssize_t *nbytes)
  +static ap_status_t os2_writev(ap_iol *viol, const struct iovec *vec, int 
nvec, ap_ssize_t *nbytes)
   {
   return ap_sendv(((iol_socket *)viol)->sock, vec, nvec, nbytes);
   }
   
  -ap_status_t os2_read(ap_iol *viol, char *buf, ap_size_t size, ap_ssize_t 
*nbytes)
  +static ap_status_t os2_read(ap_iol *viol, char *buf, ap_size_t size, 
ap_ssize_t *nbytes)
   {
   *nbytes = size;
   return ap_recv(((iol_socket *)viol)->sock, buf, nbytes);
  @@ -118,15 +117,10 @@
   {
   iol_socket *iol = (iol_socket *)viol;
   int rv;
  -int saved_errno;
   
   rv = ap_close_socket(iol->sock);
  -saved_errno = errno;
   free(iol);
  -if (rv == 0) {
  -return APR_SUCCESS;
  -}
  -return saved_errno;
  +return rv;
   }
   
   static const ap_iol_methods socket_methods = {