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