]>
Commit | Line | Data |
---|---|---|
8af586c3 AM |
1 | --- device-mapper/configure.in~ 2008-07-06 19:22:49.965050005 +0200 |
2 | +++ device-mapper/configure.in 2008-07-06 19:26:11.998363857 +0200 | |
3 | @@ -107,7 +107,7 @@ | |
4 | ||
5 | ################################################################################ | |
6 | dnl -- Check for functions | |
7 | -AC_CHECK_FUNCS([gethostname getpagesize memset mkdir rmdir munmap setlocale \ | |
8 | +AC_CHECK_FUNCS([gethostname memset mkdir rmdir munmap \ | |
9 | strcasecmp strchr strdup strncasecmp strerror strrchr strstr strtol strtoul \ | |
10 | uname], , [AC_MSG_ERROR(bailing out)]) | |
11 | AC_FUNC_ALLOCA | |
b5f876a1 | 12 | --- device-mapper.1.02.09.orig/configure.in 2006-09-27 18:22:22.000000000 +0000 |
13 | +++ device-mapper.1.02.09.klibc/configure.in 2006-09-27 18:22:22.000000000 +0000 | |
8af586c3 AM |
14 | @@ -87,7 +87,7 @@ |
15 | AC_HEADER_SYS_WAIT | |
93de1115 JK |
16 | AC_HEADER_TIME |
17 | ||
8af586c3 AM |
18 | -AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h inttypes.h limits.h \ |
19 | +AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h inttypes.h limits.h \ | |
20 | stdarg.h stdio.h stdlib.h string.h sys/ioctl.h sys/param.h sys/stat.h \ | |
21 | sys/types.h unistd.h], , [AC_MSG_ERROR(bailing out)]) | |
22 | AC_CHECK_HEADERS(termios.h sys/statvfs.h) | |
b5f876a1 | 23 | --- device-mapper.1.02.09.orig/dmsetup/dmsetup.c 2006-08-10 20:53:21.000000000 +0000 |
24 | +++ device-mapper.1.02.09.klibc/dmsetup/dmsetup.c 2006-09-27 18:22:58.000000000 +0000 | |
25 | @@ -31,12 +31,13 @@ | |
93de1115 JK |
26 | #include <dirent.h> |
27 | #include <errno.h> | |
28 | #include <unistd.h> | |
29 | -#include <libgen.h> | |
30 | #include <sys/wait.h> | |
31 | #include <unistd.h> | |
32 | #include <sys/param.h> | |
b5f876a1 | 33 | +#ifndef __KLIBC__ |
34 | #include <locale.h> | |
35 | #include <langinfo.h> | |
36 | +#endif | |
37 | ||
38 | #ifdef HAVE_SYS_IOCTL_H | |
39 | # include <sys/ioctl.h> | |
40 | @@ -1547,9 +1548,11 @@ | |
a61b39d0 AM |
41 | int len; |
42 | ||
43 | /* Symbol set default */ | |
44 | +#ifndef __KLIBC__ | |
45 | if (!strcmp(nl_langinfo(CODESET), "UTF-8")) | |
46 | _tsym = &_tsym_utf; | |
47 | else | |
48 | +#endif | |
49 | _tsym = &_tsym_ascii; | |
50 | ||
51 | /* Default */ | |
b5f876a1 | 52 | @@ -1647,7 +1650,9 @@ |
93de1115 JK |
53 | memset(&_values, 0, sizeof(_values)); |
54 | ||
55 | namebase = strdup((*argv)[0]); | |
56 | - base = basename(namebase); | |
57 | + base = strrchr(namebase,'/'); | |
58 | + if (base != NULL) *base++ = 0; | |
59 | + else base = namebase; | |
60 | ||
61 | if (!strcmp(base, "devmap_name")) { | |
62 | free(namebase); | |
b5f876a1 | 63 | @@ -1783,7 +1788,9 @@ |
a61b39d0 AM |
64 | struct command *c; |
65 | int r = 1; | |
66 | ||
67 | +#ifndef __KLIBC__ | |
d2a9d666 | 68 | (void) setlocale(LC_ALL, ""); |
a61b39d0 AM |
69 | +#endif |
70 | ||
71 | if (!_process_switches(&argc, &argv)) { | |
72 | fprintf(stderr, "Couldn't process command line.\n"); | |
a01b84a1 JB |
73 | --- device-mapper.1.02.22/lib/ioctl/libdm-iface.c.orig 2007-08-21 18:26:07.000000000 +0200 |
74 | +++ device-mapper.1.02.22/lib/ioctl/libdm-iface.c 2007-09-09 23:59:33.337996036 +0200 | |
75 | @@ -134,17 +134,25 @@ | |
93de1115 JK |
76 | uint32_t *number) |
77 | { | |
78 | FILE *fl; | |
79 | - char nm[256]; | |
93de1115 | 80 | + char nm[256], buf[300]; |
c97ab21d AM |
81 | int c; |
82 | - uint32_t num; | |
83 | + uint32_t num, size; | |
93de1115 JK |
84 | |
85 | if (!(fl = fopen(file, "r"))) { | |
a01b84a1 | 86 | log_sys_error("fopen", file); |
93de1115 JK |
87 | return 0; |
88 | } | |
89 | ||
90 | - while (!feof(fl)) { | |
c97ab21d | 91 | - if (fscanf(fl, "%d %255s\n", &num, &nm[0]) == 2) { |
93de1115 JK |
92 | + /* Use fread+sscanf for klibc compatibility. */ |
93 | + do { | |
94 | + size = 0; | |
95 | + do { | |
96 | + num = fread(&buf[size], sizeof(char), 1, fl); | |
97 | + if (num > 0) | |
98 | + size++; | |
99 | + } while (num > 0 && buf[size - 1] != '\n'); | |
100 | + buf[size] = '\0'; | |
35dd99f6 | 101 | + if (sscanf(buf, "%d %255s\n", &num, &nm[0]) == 2) { |
93de1115 | 102 | if (!strcmp(name, nm)) { |
c97ab21d AM |
103 | if (number) { |
104 | *number = num; | |
a01b84a1 | 105 | @@ -154,10 +162,9 @@ |
c97ab21d AM |
106 | } |
107 | dm_bit_set(_dm_bitset, num); | |
93de1115 JK |
108 | } |
109 | - } else do { | |
110 | - c = fgetc(fl); | |
111 | - } while (c != EOF && c != '\n'); | |
112 | - } | |
2ecb94af | 113 | + } |
35dd99f6 | 114 | + } while (size > 0); |
2ecb94af | 115 | + |
116 | if (fclose(fl)) | |
a01b84a1 JB |
117 | log_sys_error("fclose", file); |
118 | ||
119 | --- device-mapper.1.02.22/lib/libdm-file.c.orig 2007-08-21 18:26:06.000000000 +0200 | |
120 | +++ device-mapper.1.02.22/lib/libdm-file.c 2007-09-10 00:20:00.475926641 +0200 | |
121 | @@ -15,10 +15,16 @@ | |
93de1115 | 122 | |
93de1115 | 123 | #include "lib.h" |
93de1115 JK |
124 | |
125 | -#include <sys/file.h> | |
126 | #include <fcntl.h> | |
127 | #include <dirent.h> | |
128 | ||
93de1115 JK |
129 | +#ifndef __KLIBC__ |
130 | +# include <sys/file.h> | |
131 | +# ifdef linux | |
132 | +# include <malloc.h> | |
133 | +# endif | |
c97ab21d AM |
134 | +#endif |
135 | + | |
93de1115 | 136 | static int _create_dir_recursive(const char *dir) |
c97ab21d AM |
137 | { |
138 | char *orig, *s; | |
a01b84a1 JB |
139 | @@ -73,7 +79,11 @@ |
140 | ||
141 | int dm_fclose(FILE *stream) | |
142 | { | |
143 | +#ifdef __KLIBC__ | |
144 | + int prev_fail = 0; | |
145 | +#else | |
146 | int prev_fail = ferror(stream); | |
147 | +#endif | |
148 | int fclose_fail = fclose(stream); | |
149 | ||
150 | /* If there was a previous failure, but fclose succeeded, |