diff options
Diffstat (limited to 'meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch')
-rw-r--r-- | meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch new file mode 100644 index 000000000..2e43d5d97 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From 8318852ef4f768bed31072aa7b57e11adc1f639c Mon Sep 17 00:00:00 2001 | ||
2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
3 | Date: Sun, 29 Jun 2014 00:44:03 +0200 | ||
4 | Subject: [PATCH 5/6] common.h: more workarounds for klibc compatibility | ||
5 | |||
6 | Patch is addressing two issues: | ||
7 | * First, Klibc doesn't have rpmatch(). | ||
8 | * Second, Klibc lacks getline() | ||
9 | |||
10 | Fixes: | ||
11 | | LD ubi-utils/ubiformat | ||
12 | | .../git/ubi-utils/ubiformat.o: In function `prompt': | ||
13 | | .../git/./include/common.h:157: undefined reference to `getline' | ||
14 | | .../git/./include/common.h:164: undefined reference to `rpmatch' | ||
15 | | .../git/./include/common.h:157: undefined reference to `getline' | ||
16 | | .../git/./include/common.h:164: undefined reference to `rpmatch' | ||
17 | |||
18 | Upstream-Status: Pending | ||
19 | |||
20 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
21 | --- | ||
22 | include/common.h | 10 ++++++---- | ||
23 | 1 file changed, 6 insertions(+), 4 deletions(-) | ||
24 | |||
25 | diff --git a/include/common.h b/include/common.h | ||
26 | index 77f3f7d..2cbee0f 100644 | ||
27 | --- a/include/common.h | ||
28 | +++ b/include/common.h | ||
29 | @@ -126,7 +126,7 @@ static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1]; | ||
30 | fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ | ||
31 | } while(0) | ||
32 | |||
33 | -#if defined(__UCLIBC__) | ||
34 | +#if defined(__UCLIBC__) || defined(__KLIBC__) | ||
35 | /* uClibc versions before 0.9.34 don't have rpmatch() */ | ||
36 | #if __UCLIBC_MAJOR__ == 0 && \ | ||
37 | (__UCLIBC_MINOR__ < 9 || \ | ||
38 | @@ -146,15 +146,17 @@ static inline int __rpmatch(const char *resp) | ||
39 | */ | ||
40 | static inline bool prompt(const char *msg, bool def) | ||
41 | { | ||
42 | - char *line = NULL; | ||
43 | - size_t len; | ||
44 | + char *line; | ||
45 | bool ret = def; | ||
46 | |||
47 | + const int sizeof_line = 2; | ||
48 | + line = malloc(sizeof_line); | ||
49 | + | ||
50 | do { | ||
51 | normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N'); | ||
52 | fflush(stdout); | ||
53 | |||
54 | - while (getline(&line, &len, stdin) == -1) { | ||
55 | + while (fgets(line, sizeof_line, stdin) == NULL) { | ||
56 | printf("failed to read prompt; assuming '%s'\n", | ||
57 | def ? "yes" : "no"); | ||
58 | break; | ||
59 | -- | ||
60 | 1.9.1 | ||
61 | |||