Commit fd98e9c7 authored by Timo Teräs's avatar Timo Teräs

modifications for the previous commit in error message handling

forgot to --amend my changes
parent 74dc8e23
......@@ -32,7 +32,8 @@
#define NULL 0L
#endif
#define EAPKSTALEINDEX 1024
#define EAPKBADURL 1024
#define EAPKSTALEINDEX 1025
static inline void *ERR_PTR(long error) { return (void*) error; }
static inline void *ERR_CAST(const void *ptr) { return (void*) ptr; }
......
......@@ -2591,6 +2591,8 @@ static int apk_db_unpack_pkg(struct apk_database *db,
bs = apk_bstream_from_fd_url(filefd, file);
if (IS_ERR_OR_NULL(bs)) {
r = PTR_ERR(bs);
if (r == -ENOENT && pkg->filename == NULL)
r = -EAPKSTALEINDEX;
goto err_msg;
}
if (need_copy) {
......
......@@ -143,15 +143,15 @@ const char *apk_error_str(int error)
case ENXIO:
return "DNS lookup error";
case EREMOTEIO:
return "error code returned by repo server (try 'apk update')";
return "remote server returned error (try 'apk update')";
case ETIMEDOUT:
return "operation timed out";
case EAGAIN:
return "temporary error (try again later)";
case EINVAL:
case EAPKBADURL:
return "invalid URL (check your repositories file)";
case EAPKSTALEINDEX:
return "file not available from repo server (try 'apk update')";
return "package mentioned in index not found (try 'apk update')";
default:
return strerror(error);
}
......
......@@ -58,7 +58,7 @@ static int fetch_maperror(int ec)
[FETCH_TIMEOUT] = -ETIMEDOUT,
[FETCH_UNAVAIL] = -ENOENT,
[FETCH_UNKNOWN] = -EIO,
[FETCH_URL] = -EINVAL,
[FETCH_URL] = -EAPKBADURL,
[FETCH_UNCHANGED] = -EALREADY,
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment