aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-11-27 15:01:56 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-11-27 15:01:56 +0000
commit40e8649947bab2527c9ae9e9c6b5af8a3dfbee92 (patch)
tree54bf92fddd77b8f63c33dba81be97cede8ba122c /tools/firmware-utils
parent974f286261065f972e4af9065e84e5a8c94942cc (diff)
downloadupstream-40e8649947bab2527c9ae9e9c6b5af8a3dfbee92.tar.gz
upstream-40e8649947bab2527c9ae9e9c6b5af8a3dfbee92.tar.bz2
upstream-40e8649947bab2527c9ae9e9c6b5af8a3dfbee92.zip
firmware-utils: remove dependency on error.h in tplink-safeloader
Fixes build on Mac OS X Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43402
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r--tools/firmware-utils/src/tplink-safeloader.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 23d703ffe8..9c5bb54ffb 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -34,7 +34,6 @@
#include <assert.h>
#include <errno.h>
-#include <error.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
@@ -143,6 +142,14 @@ static const unsigned char cpe510_support_list[] =
"CPE220(TP-LINK|UN|N300-2):1.0\r\n"
"\r\n\xff";
+#define error(_ret, _errno, _str, ...) \
+ do { \
+ fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
+ strerror(_errno)); \
+ if (_ret) \
+ exit(_ret); \
+ } while (0)
+
/** Allocates a new image partition */
struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
@@ -200,6 +207,7 @@ struct image_partition_entry make_soft_version(uint32_t rev) {
struct soft_version *s = (struct soft_version *)entry.data;
time_t t;
+
if (time(&t) == (time_t)(-1))
error(1, errno, "time");