summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-04-24 09:31:28 +0300
committerTimo Teräs <timo.teras@iki.fi>2015-04-24 09:32:22 +0300
commitfd98e9c7189a18b27935f92449dea58962e6cbdd (patch)
treef89aa4f26d9dd2b2015a3b966b9229c1ded10b85
parent74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049 (diff)
downloadapk-tools-fd98e9c7189a18b27935f92449dea58962e6cbdd.tar.gz
apk-tools-fd98e9c7189a18b27935f92449dea58962e6cbdd.tar.bz2
apk-tools-fd98e9c7189a18b27935f92449dea58962e6cbdd.tar.xz
apk-tools-fd98e9c7189a18b27935f92449dea58962e6cbdd.zip
modifications for the previous commit in error message handling
forgot to --amend my changes
-rw-r--r--src/apk_defines.h3
-rw-r--r--src/database.c2
-rw-r--r--src/print.c6
-rw-r--r--src/url.c2
4 files changed, 8 insertions, 5 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index 6bf4624..1867b82 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -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; }
diff --git a/src/database.c b/src/database.c
index 0b26bb2..0f0496b 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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) {
diff --git a/src/print.c b/src/print.c
index e0681ee..3e2a570 100644
--- a/src/print.c
+++ b/src/print.c
@@ -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);
}
diff --git a/src/url.c b/src/url.c
index 2dc47c7..b9fcc53 100644
--- a/src/url.c
+++ b/src/url.c
@@ -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,
};