diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-11-04 11:40:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-11-04 11:40:16 +0000 |
commit | 28799498ed2b2253aaa68dbb74be9612b9cd3d64 (patch) | |
tree | 3339e46540c17b1a5e07fc70b227074db59fff8a | |
parent | 94e2ebc3294bb23855db3b9acabe6df9f2801df9 (diff) | |
download | drakx-28799498ed2b2253aaa68dbb74be9612b9cd3d64.tar drakx-28799498ed2b2253aaa68dbb74be9612b9cd3d64.tar.gz drakx-28799498ed2b2253aaa68dbb74be9612b9cd3d64.tar.bz2 drakx-28799498ed2b2253aaa68dbb74be9612b9cd3d64.tar.xz drakx-28799498ed2b2253aaa68dbb74be9612b9cd3d64.zip |
create str_ftp_error()
-rw-r--r-- | mdk-stage1/network.c | 14 | ||||
-rw-r--r-- | mdk-stage1/url.c | 10 | ||||
-rw-r--r-- | mdk-stage1/url.h | 1 |
3 files changed, 14 insertions, 11 deletions
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 8bad63c93..17c39dc96 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -999,17 +999,9 @@ enum return_type ftp_prepare(void) } if (fd < 0) { - log_message("FTP: error get %d", fd); - if (fd == FTPERR_PASSIVE_ERROR) - stg1_error_message("Error: error with passive connection."); - else if (fd == FTPERR_FAILED_CONNECT) - stg1_error_message("Error: couldn't connect to server."); - else if (fd == FTPERR_FILE_NOT_FOUND) - stg1_error_message("Error: file not found (%s).", location_full); - else if (fd == FTPERR_BAD_SERVER_RESPONSE) - stg1_error_message("Error: bad server response (server too busy?)."); - else - stg1_error_message("Error: couldn't retrieve Installation program."); + char *msg = str_ftp_error(fd); + log_message("FTP: error get %d for remote file %s", fd, location_full); + stg1_error_message("Error: %s.", msg ? msg : "couldn't retrieve Installation program"); results = RETURN_BACK; continue; } diff --git a/mdk-stage1/url.c b/mdk-stage1/url.c index c346564e1..6187a6195 100644 --- a/mdk-stage1/url.c +++ b/mdk-stage1/url.c @@ -391,6 +391,16 @@ int ftp_end_data_command(int sock) } +char *str_ftp_error(int error) +{ + return error == FTPERR_PASSIVE_ERROR ? "error with passive connection" : + error == FTPERR_FAILED_CONNECT ? "couldn't connect to server" : + error == FTPERR_FILE_NOT_FOUND ? "file not found" : + error == FTPERR_BAD_SERVER_RESPONSE ? "bad server response (server too busy?)" : + NULL; +} + + int http_download_file(char * hostname, char * remotename, int * size, char * proxyprotocol, char * proxyname, char * proxyport) { char * buf; diff --git a/mdk-stage1/url.h b/mdk-stage1/url.h index 19c1a6874..7a9dcfb4b 100644 --- a/mdk-stage1/url.h +++ b/mdk-stage1/url.h @@ -26,6 +26,7 @@ int ftp_open_connection(char * host, char * name, char * password, char * proxy) int ftp_get_filesize(int sock, char * remotename); int ftp_start_download(int sock, char * remotename, int * size); int ftp_end_data_command(int sock); +char *str_ftp_error(int error); int http_download_file(char * hostname, char * remotename, int * size, char * proxyprotocol, char * proxyname, char * proxyport); |