properly abort if we fail to create debug files instead of crashing.
[citadel.git] / citadel / msgbase.c
index 95909e7cdbc682414a33904520215c34b925cbb0..135fe0e39b7f53c73882e3f0bbe46859ae4a054b 100644 (file)
@@ -3264,6 +3264,11 @@ eReadState CtdlReadMessageBodyAsync(AsyncIO *IO)
                 IO->SendBuf.fd);
        
        fd = fopen(fn, "a+");
+       if (fd == NULL) {
+               syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+               cit_backtrace();
+               exit(1);
+       }
 #endif
 
        ReadMsg = IO->ReadMsg;
@@ -3345,7 +3350,7 @@ eReadState CtdlReadMessageBodyAsync(AsyncIO *IO)
        if (MsgFinished)
                return eReadSuccess;
        else 
-               return eAbort;
+               return eReadFail;
 }