Browse Subversion Repository
Diff of /tags/REL-2.2/ftp_quit.c
Parent Directory
| Revision Log
| Patch
| 38 |
int ftp_quit( LIBOFTP *ftp ) |
int ftp_quit( LIBOFTP *ftp ) |
| 39 |
{ |
{ |
| 40 |
char str1[] = "QUIT\r\n"; |
char str1[] = "QUIT\r\n"; |
| 41 |
int ret; |
int res; |
| 42 |
|
|
| 43 |
/* |
/* |
| 44 |
* send QUIT command |
* send QUIT command |
| 45 |
*/ |
*/ |
| 46 |
if( ftp_send_command( ftp, str1 ) < 0 ) { |
if( ftp_send_command( ftp, str1 ) < 0 ) { |
| 47 |
DEBUGPRINT1( "quit: command sending error. %s\n", str1 ); |
DEBUGPRINT1( "command sending error. %s\n", str1 ); |
| 48 |
return -1; |
return LIBOFTP_ERROR_OS; |
| 49 |
} |
} |
| 50 |
|
|
| 51 |
if( (ret = ftp_receive_response( ftp, 0, 0 )) != 221 ) { /* 221: Service closing control connection. */ |
res = ftp_receive_response( ftp, ftp->error_message, sizeof(ftp->error_message)-1 ); |
| 52 |
DEBUGPRINT1( "quit: command response error. %d\n", ret ); |
if( res != 221 ) { /* 221: Service closing control connection. */ |
| 53 |
return -2; |
DEBUGPRINT1( "command response error. %d\n", res ); |
| 54 |
|
return res < 0? res: LIBOFTP_ERROR_PROTOCOL; |
| 55 |
} |
} |
| 56 |
|
|
| 57 |
return 0; |
return 0; |
|
|
Legend:
| Removed from v.20 |
|
| changed lines |
| |
Added in v.29 |
|
|
| |