Kick out ftpStrerror() and related error code defines
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 7 Jul 2008 07:48:06 +0000 (10:48 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 7 Jul 2008 07:48:06 +0000 (10:48 +0300)
- our url-retrieval error codes depend on the helper used which is
  configurable via macros so hardcoding eg curl codes wont work either
- need to figure out something better, pass helper error messages through
  FD_t or something...

build/parsePrep.c
lib/rpminstall.c
rpmio/rpmio.c
rpmio/rpmio.h

index 3fcd3ab..c18945a 100644 (file)
@@ -180,7 +180,7 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
            if ((rc = urlGetFile(sp->fullSource, fn)) != 0) {
                rpmlog(RPMLOG_ERR,
                        _("Couldn't download nosource %s: %s\n"),
-                       sp->fullSource, ftpStrerror(rc));
+                       sp->fullSource);
                return NULL;
            }
        }
index fd60637..5eef571 100644 (file)
@@ -312,8 +312,7 @@ restart:
 
            if (rc != 0) {
                rpmlog(RPMLOG_ERR,
-                       _("skipping %s - transfer failed - %s\n"),
-                       fileURL, ftpStrerror(rc));
+                       _("skipping %s - transfer failed\n"), fileURL);
                eiu->numFailed++;
                eiu->pkgURL[eiu->pkgx] = NULL;
                tfn = _free(tfn);
index 86dcaf3..bf26154 100644 (file)
@@ -500,64 +500,6 @@ int fdReadable(FD_t fd, int secs)
     } while (1);
 }
 
-/* =============================================================== */
-/* Support for FTP/HTTP I/O.
- */
-const char * ftpStrerror(int errorNumber)
-{
-    switch (errorNumber) {
-    case 0:
-       return _("Success");
-
-    /* HACK error impediance match, coalesce and rename. */
-    case FTPERR_NE_ERROR:
-       return ("NE_ERROR: Generic error.");
-    case FTPERR_NE_LOOKUP:
-       return ("NE_LOOKUP: Hostname lookup failed.");
-    case FTPERR_NE_AUTH:
-       return ("NE_AUTH: Server authentication failed.");
-    case FTPERR_NE_PROXYAUTH:
-       return ("NE_PROXYAUTH: Proxy authentication failed.");
-    case FTPERR_NE_CONNECT:
-       return ("NE_CONNECT: Could not connect to server.");
-    case FTPERR_NE_TIMEOUT:
-       return ("NE_TIMEOUT: Connection timed out.");
-    case FTPERR_NE_FAILED:
-       return ("NE_FAILED: The precondition failed.");
-    case FTPERR_NE_RETRY:
-       return ("NE_RETRY: Retry request.");
-    case FTPERR_NE_REDIRECT:
-       return ("NE_REDIRECT: Redirect received.");
-
-    case FTPERR_BAD_SERVER_RESPONSE:
-       return _("Bad server response");
-    case FTPERR_SERVER_IO_ERROR:
-       return _("Server I/O error");
-    case FTPERR_SERVER_TIMEOUT:
-       return _("Server timeout");
-    case FTPERR_BAD_HOST_ADDR:
-       return _("Unable to lookup server host address");
-    case FTPERR_BAD_HOSTNAME:
-       return _("Unable to lookup server host name");
-    case FTPERR_FAILED_CONNECT:
-       return _("Failed to connect to server");
-    case FTPERR_FAILED_DATA_CONNECT:
-       return _("Failed to establish data connection to server");
-    case FTPERR_FILE_IO_ERROR:
-       return _("I/O error to local file");
-    case FTPERR_PASSIVE_ERROR:
-       return _("Error setting remote server to passive mode");
-    case FTPERR_FILE_NOT_FOUND:
-       return _("File not found on server");
-    case FTPERR_NIC_ABORT_IN_PROGRESS:
-       return _("Abort in progress");
-
-    case FTPERR_UNKNOWN:
-    default:
-       return _("Unknown or unexpected error");
-    }
-}
-
 int ufdCopy(FD_t sfd, FD_t tfd)
 {
     char buf[BUFSIZ];
@@ -578,15 +520,14 @@ int ufdCopy(FD_t sfd, FD_t tfd)
        if (rc < 0)
            break;
        if (rc != itemsRead) {
-           rc = FTPERR_FILE_IO_ERROR;
+           rc = -1;
            break;
        }
 
        itemsCopied += itemsRead;
     }
 
-    DBGIO(sfd, (stderr, "++ copied %d bytes: %s\n", itemsCopied,
-       ftpStrerror(rc)));
+    DBGIO(sfd, (stderr, "++ copied %d bytes\n", itemsCopied));
 
     return rc;
 }
@@ -749,7 +690,7 @@ static int ufdClose( void * cookie)
  * Deal with remote url's by fetching them with a helper application
  * and treat as local file afterwards.
  * TODO:
- * - better error checking + reporting
+ * - better error checking + reporting 
  * - curl & friends don't know about hkp://, transform to http?
  */
 
index eed47e7..ca05d15 100644 (file)
@@ -138,38 +138,6 @@ int fdWritable(FD_t fd, int secs);
 int fdReadable(FD_t fd, int secs);
 
 /**
- * FTP and HTTP error codes.
- */
-typedef enum ftperrCode_e {
-    FTPERR_NE_ERROR            = -1,   /*!< Generic error. */
-    FTPERR_NE_LOOKUP           = -2,   /*!< Hostname lookup failed. */
-    FTPERR_NE_AUTH             = -3,   /*!< Server authentication failed. */
-    FTPERR_NE_PROXYAUTH                = -4,   /*!< Proxy authentication failed. */
-    FTPERR_NE_CONNECT          = -5,   /*!< Could not connect to server. */
-    FTPERR_NE_TIMEOUT          = -6,   /*!< Connection timed out. */
-    FTPERR_NE_FAILED           = -7,   /*!< The precondition failed. */
-    FTPERR_NE_RETRY            = -8,   /*!< Retry request. */
-    FTPERR_NE_REDIRECT         = -9,   /*!< Redirect received. */
-
-    FTPERR_BAD_SERVER_RESPONSE = -81,  /*!< Bad server response */
-    FTPERR_SERVER_IO_ERROR     = -82,  /*!< Server I/O error */
-    FTPERR_SERVER_TIMEOUT      = -83,  /*!< Server timeout */
-    FTPERR_BAD_HOST_ADDR       = -84,  /*!< Unable to lookup server host address */
-    FTPERR_BAD_HOSTNAME                = -85,  /*!< Unable to lookup server host name */
-    FTPERR_FAILED_CONNECT      = -86,  /*!< Failed to connect to server */
-    FTPERR_FILE_IO_ERROR       = -87,  /*!< Failed to establish data connection to server */
-    FTPERR_PASSIVE_ERROR       = -88,  /*!< I/O error to local file */
-    FTPERR_FAILED_DATA_CONNECT = -89,  /*!< Error setting remote server to passive mode */
-    FTPERR_FILE_NOT_FOUND      = -90,  /*!< File not found on server */
-    FTPERR_NIC_ABORT_IN_PROGRESS= -91, /*!< Abort in progress */
-    FTPERR_UNKNOWN             = -100  /*!< Unknown or unexpected error */
-} ftperrCode;
-
-/**
- */
-const char * ftpStrerror(int errorNumber);
-
-/**
  */
 int ufdCopy(FD_t sfd, FD_t tfd);