Author: nbd
Date: 2014-11-27 16:01:56 +0100 (Thu, 27 Nov 2014)
New Revision: 43402

Modified:
   trunk/tools/firmware-utils/src/tplink-safeloader.c
Log:
firmware-utils: remove dependency on error.h in tplink-safeloader

Fixes build on Mac OS X

Signed-off-by: Felix Fietkau <[email protected]>

Modified: trunk/tools/firmware-utils/src/tplink-safeloader.c
===================================================================
--- trunk/tools/firmware-utils/src/tplink-safeloader.c  2014-11-27 14:27:34 UTC 
(rev 43401)
+++ trunk/tools/firmware-utils/src/tplink-safeloader.c  2014-11-27 15:01:56 UTC 
(rev 43402)
@@ -34,7 +34,6 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -143,7 +142,15 @@
        "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) {
        struct image_partition_entry entry = {name, len, malloc(len)};
@@ -200,6 +207,7 @@
        struct soft_version *s = (struct soft_version *)entry.data;
 
        time_t t;
+
        if (time(&t) == (time_t)(-1))
                error(1, errno, "time");
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to