summaryrefslogtreecommitdiff
path: root/src/apk_defines.h
diff options
context:
space:
mode:
authorAlex Dowad <alexinbeijing@gmail.com>2015-04-22 08:40:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-04-22 20:08:16 +0300
commit74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049 (patch)
treeeb54a7746ee7c86d83fdd22e9e90d5cf38efc575 /src/apk_defines.h
parentbe31eb24d8724b65929d0b5a9d037cde565c9dfe (diff)
downloadapk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.gz
apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.bz2
apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.xz
apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.zip
print.c: provide more detailed error messages if retrieving a package fails
fetch_maperror() translates error codes returned by libfetch to our error codes. Handle those in apk_error_str(), returning error messages which advise the user of the most likely fix. A custom error code, EAPKSTALEINDEX, has been added for cases where retrieving a package fails due to a HTTP error 404 or similar. [TimoT: add also EAPKBADURL, as well as organize a bit better where the EAPKSTALEINDEX is generated]
Diffstat (limited to 'src/apk_defines.h')
-rw-r--r--src/apk_defines.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index d27bad4..6bf4624 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -32,6 +32,8 @@
#define NULL 0L
#endif
+#define EAPKSTALEINDEX 1024
+
static inline void *ERR_PTR(long error) { return (void*) error; }
static inline void *ERR_CAST(const void *ptr) { return (void*) ptr; }
static inline int PTR_ERR(const void *ptr) { return (int)(long) ptr; }