-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
patches/openwrt/0011-firmware-utils-remove-dependency-on-error.h-in-tplink-safeloader.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From: Matthias Schiffer <mschiffer@universe-factory.net> | ||
Date: Sun, 11 Jan 2015 09:14:34 +0100 | ||
Subject: firmware-utils: remove dependency on error.h in tplink-safeloader | ||
|
||
Fixes build on Mac OS X | ||
|
||
Signed-off-by: Felix Fietkau <nbd@openwrt.org> | ||
|
||
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c | ||
index 23d703f..9c5bb54 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"); | ||
|