Develop and Download Open Source Software

Browse Subversion Repository

Diff of /tags/REL-2.2/ftp_get_buffer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 28 by hirohitohigashi, Sat Feb 28 04:14:38 2009 UTC revision 29 by hirohitohigashi, Sat Feb 28 12:48:31 2009 UTC
# Line 73  int ftp_get_buffer( LIBOFTP *ftp, const Line 73  int ftp_get_buffer( LIBOFTP *ftp, const
73          n = recv( data_socket, p, len, 0 );          n = recv( data_socket, p, len, 0 );
74          DEBUGPRINT1( "RECV: n=%d\n", n );          DEBUGPRINT1( "RECV: n=%d\n", n );
75          if( n < 0 ) {          if( n < 0 ) {
76              DEBUGPRINT1( "get_buffer: recv error. %s\n", strerror(errno) );              DEBUGPRINT1( "recv error. %s\n", strerror(errno) );
77                copy_strerror();
78              close( data_socket );              close( data_socket );
79              return -1;              return LIBOFTP_ERROR_OS;
80          }          }
81          if( n == 0 ) {          if( n == 0 ) {
82              break;              break;
# Line 91  int ftp_get_buffer( LIBOFTP *ftp, const Line 92  int ftp_get_buffer( LIBOFTP *ftp, const
92      /*      /*
93       * receive response.       * receive response.
94       */       */
95      if( (res = ftp_receive_response( ftp, 0, 0 )) != 226 ) {    /* 226: Closing data connection. */      res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 );
96          DEBUGPRINT1( "get_buffer: got illegal response %d\n", res );      if( res != 226 ) {                                          /* 226: Closing data connection. */
97          return -2;          DEBUGPRINT1( "got illegal response %d\n", res );
98            return res<0? res: LIBOFTP_ERROR_PROTOCOL;
99      }      }
100    
101      if( bufsiz <= 0 ) {      if( bufsiz <= 0 ) {
102          DEBUGPRINT1( "get_buffer: buffer too small. %s\n", "" );          DEBUGPRINT1( "buffer too small. %s\n", "" );
103          return -3;          strncpy( ftp->error_message, "buffer too small", sizeof( ftp->error_message ) - 1 );
104            return LIBOFTP_ERROR_BUFFER;
105      }      }
106      return 0;  
107        return LIBOFTP_NOERROR;
108  }  }

Legend:
Removed from v.28  
changed lines
  Added in v.29

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26