From 0c28d1edf3dc4853c77ff89e0732afcfb9723aa0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 24 Mar 2010 22:35:27 +0000 Subject: [PATCH] * client_read_blob(): behave the same way in non-ssl as ssl, so we return <0 in case of errors. --- citadel/sysdep.c | 53 +++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 1fba5ebd3..41bc7d0e7 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -573,10 +573,15 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout) #ifdef HAVE_OPENSSL if (CCC->redirect_ssl) { retval = client_read_sslblob(Target, bytes, timeout); + if (retval < 0) { + CtdlLogPrintf(CTDL_CRIT, + "%s failed\n", + __FUNCTION__); + } } else #endif - + { retval = StrBufReadBLOBBuffered(Target, CCC->ReadBuf, &CCC->Pos, @@ -585,33 +590,35 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout) bytes, O_TERM, &Error); - if (retval < 0) { - CtdlLogPrintf(CTDL_CRIT, - "%s failed\n", - __FUNCTION__); - return -1; - } - else - { + if (retval < 0) { + CtdlLogPrintf(CTDL_CRIT, + "%s failed: %s\n", + __FUNCTION__, + Error); + return retval; + } + else + { #ifdef BIGBAD_IODBG - int rv = 0; - char fn [SIZ]; - FILE *fd; - - snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid); - - fd = fopen(fn, "a+"); - fprintf(fd, "Read: BufSize: %d BufContent: [", - StrLength(Target)); - rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd); - fprintf(fd, "]\n"); - + int rv = 0; + char fn [SIZ]; + FILE *fd; - fclose(fd); + snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid); + + fd = fopen(fn, "a+"); + fprintf(fd, "Read: BufSize: %d BufContent: [", + StrLength(Target)); + rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd); + fprintf(fd, "]\n"); + + + fclose(fd); #endif + } } - return retval == bytes; + return retval; } int client_read_to(char *buf, int bytes, int timeout) -- 2.30.2