From: Manoj Kasichainula Date: Sun, 31 Oct 1999 09:02:55 +0000 (+0000) Subject: Undo the ap_bgets errno patch. It will return status with ap_berror(). X-Git-Tag: 1.3.10~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c5ab990085e3ec26ff25a36dfa259ad0d64c437;p=thirdparty%2Fapache%2Fhttpd.git Undo the ap_bgets errno patch. It will return status with ap_berror(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84076 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 811989024d2..08e7b2fe3f2 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -201,7 +201,6 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, ap_file_t *f; int i; struct stat finfo; - ap_ssize_t n; /* Ignored */ if (!conf->logname || ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) @@ -209,22 +208,19 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, (ap_open(&f, ap_server_root_relative(r->pool, conf->logname), APR_APPEND, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { /* Soak up script output */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, &n) - == APR_SUCCESS) + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) continue; #ifdef WIN32 /* Soak up stderr and redirect it to the error log. * Script output to stderr is already directed to the error log * on Unix, thanks to the magic of fork(). */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) - == APR_SUCCESS) { + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r, "%s", argsbuffer); } #else - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) - == APR_SUCCESS) + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) continue; #endif return ret; @@ -260,19 +256,18 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, if (sbuf && *sbuf) ap_fprintf(f, "%s\n", sbuf); - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, &n) == APR_SUCCESS) { + if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { ap_puts("%stdout\n", f); ap_puts(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, &n) > 0) + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) ap_puts(argsbuffer, f); ap_puts("\n", f); } - if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) == APR_SUCCESS) { + if (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { ap_puts("%stderr\n", f); ap_puts(argsbuffer, f); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) - == APR_SUCCESS) + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) ap_puts(argsbuffer, f); ap_puts("\n", f); } @@ -450,7 +445,6 @@ static int cgi_handler(request_rec *r) char *argv0, *dbuf = NULL; char *command; char **argv = NULL; - ap_ssize_t n; /* Ignored */ BUFF *script_out = NULL, *script_in = NULL, *script_err = NULL; char argsbuffer[HUGE_STRING_LEN]; @@ -597,12 +591,10 @@ static int cgi_handler(request_rec *r) if (location && location[0] == '/' && r->status == 200) { /* Soak up all the script output */ - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in, &n) - == APR_SUCCESS) { + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) { continue; } - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) - == APR_SUCCESS) { + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { continue; } /* This redirect needs to be a GET no matter what the original @@ -633,8 +625,7 @@ static int cgi_handler(request_rec *r) } ap_bclose(script_in); - while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err, &n) - == APR_SUCCESS) { + while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) { continue; } ap_bclose(script_err); diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 483e46c42a7..fd09d209368 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -674,24 +674,23 @@ API_EXPORT(int) ap_method_number_of(const char *method) 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 */ - total += nbytes; /* and how long s has become */ + n -= retval; /* Keep track of how much of s is full */ + pos += (retval - 1); /* and where s ends */ + total += retval; /* and how long s has become */ if (*pos == '\n') { /* Did we get a full line of input? */ /* @@ -716,7 +715,7 @@ static int getline(char *s, int n, BUFF *in, int fold) * the last line was not empty and we have room in the buffer and * the next line begins with a continuation character. */ - } while (fold && (nbytes != 1) && (n > 1) + } while (fold && (retval != 1) && (n > 1) && (next = ap_blookc(in)) && ((next == ' ') || (next == '\t'))); diff --git a/server/util_script.c b/server/util_script.c index ec6ed259f7c..187d9015e70 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -616,8 +616,7 @@ API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, static int getsfunc_BUFF(char *w, int len, void *fb) { - ap_ssize_t n; /* Ignored */ - return ap_bgets(w, len, (BUFF *) fb, &n) == APR_SUCCESS; + return ap_bgets(w, len, (BUFF *) fb) > 0; } API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *fb,