X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fimap.c;h=bb800827d5bdb044eefd348f00e33e1df66f009b;hb=a1a7d5dc60fb40d39c9f1cbc6b1879bc562299a7;hp=798d5b665064c5c1ae2823d406c94934e6adf086;hpb=db28d5c6f7928b707bffa193ad93dfa7556ab0ad;p=dockapps%2Fwmnotify.git diff --git a/src/imap.c b/src/imap.c index 798d5b6..bb80082 100644 --- a/src/imap.c +++ b/src/imap.c @@ -67,11 +67,8 @@ IMAP4_ReceiveResponse( void ) get_packet: len = WmnotifyGetResponse( rx_buffer, WMNOTIFY_BUFSIZE ); - if( len < 0 ) { - /* An error occured. */ - perror( PACKAGE ); - ErrorLocation( __FILE__, __LINE__ ); + /* An error occured. WmnotifyGetResponse() should have printed an error message. */ goto error; } else if( len == 0 ) { @@ -120,12 +117,19 @@ IMAP4_ReceiveResponse( void ) /* In case no delimiter was found, the token is taken to be the entire string *stringp, and *stringp is made NULL. */ if( stringp == NULL ) { - /* This should never happen. */ - ErrorLocation( __FILE__, __LINE__ ); - fprintf( stderr, " Delimiter not found in strsep() call.\n" ); - goto error; + if( token[0] == '\0' ) { + /* This means we finished parsing the last line of the buffer, but we need to + get more data to continue process the next part of the IMAP4 response. */ + goto get_packet; + } + else { + /* This should never happen. */ + ErrorLocation( __FILE__, __LINE__ ); + fprintf( stderr, " Delimiter not found in strsep() call.\n" ); + goto error; + } } - + if( token == NULL ) { /* This should never happen. */ ErrorLocation( __FILE__, __LINE__ );