0010-firmware-utils-remove-dependency-on-error.h-in-tplink-safeloader.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 11 Jan 2015 09:14:34 +0100
  3. Subject: firmware-utils: remove dependency on error.h in tplink-safeloader
  4. Fixes build on Mac OS X
  5. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6. diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
  7. index 23d703f..9c5bb54 100644
  8. --- a/tools/firmware-utils/src/tplink-safeloader.c
  9. +++ b/tools/firmware-utils/src/tplink-safeloader.c
  10. @@ -34,7 +34,6 @@
  11. #include <assert.h>
  12. #include <errno.h>
  13. -#include <error.h>
  14. #include <stdbool.h>
  15. #include <stdio.h>
  16. #include <stdint.h>
  17. @@ -143,6 +142,14 @@ static const unsigned char cpe510_support_list[] =
  18. "CPE220(TP-LINK|UN|N300-2):1.0\r\n"
  19. "\r\n\xff";
  20. +#define error(_ret, _errno, _str, ...) \
  21. + do { \
  22. + fprintf(stderr, _str ": %s\n", ## __VA_ARGS__, \
  23. + strerror(_errno)); \
  24. + if (_ret) \
  25. + exit(_ret); \
  26. + } while (0)
  27. +
  28. /** Allocates a new image partition */
  29. struct image_partition_entry alloc_image_partition(const char *name, size_t len) {
  30. @@ -200,6 +207,7 @@ struct image_partition_entry make_soft_version(uint32_t rev) {
  31. struct soft_version *s = (struct soft_version *)entry.data;
  32. time_t t;
  33. +
  34. if (time(&t) == (time_t)(-1))
  35. error(1, errno, "time");