]>
Commit | Line | Data |
---|---|---|
a61b39d0 AM |
1 | diff -urN device-mapper.1.02.05.org/configure.in device-mapper.1.02.05/configure.in |
2 | --- device-mapper.1.02.05.org/configure.in 2006-04-19 18:38:56.000000000 +0200 | |
3 | +++ device-mapper.1.02.05/configure.in 2006-04-22 20:55:32.442643250 +0200 | |
c97ab21d | 4 | @@ -66,7 +66,7 @@ |
93de1115 JK |
5 | AC_HEADER_STDC |
6 | AC_HEADER_TIME | |
7 | ||
8 | -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)) | |
9 | +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)) | |
10 | ||
c97ab21d | 11 | AC_CHECK_HEADERS(termios.h) |
93de1115 | 12 | ################################################################################ |
a61b39d0 | 13 | diff -urN device-mapper.1.02.05.org/dmsetup/dmsetup.c device-mapper.1.02.05/dmsetup/dmsetup.c |
c97ab21d | 14 | --- device-mapper.1.02.05.org/dmsetup/dmsetup.c 2006-04-06 18:20:40.000000000 +0200 |
a61b39d0 | 15 | +++ device-mapper.1.02.05/dmsetup/dmsetup.c 2006-04-22 20:55:57.180189250 +0200 |
c97ab21d | 16 | @@ -29,7 +29,6 @@ |
93de1115 JK |
17 | #include <dirent.h> |
18 | #include <errno.h> | |
19 | #include <unistd.h> | |
20 | -#include <libgen.h> | |
21 | #include <sys/wait.h> | |
22 | #include <unistd.h> | |
23 | #include <sys/param.h> | |
a61b39d0 AM |
24 | @@ -1398,9 +1397,11 @@ |
25 | int len; | |
26 | ||
27 | /* Symbol set default */ | |
28 | +#ifndef __KLIBC__ | |
29 | if (!strcmp(nl_langinfo(CODESET), "UTF-8")) | |
30 | _tsym = &_tsym_utf; | |
31 | else | |
32 | +#endif | |
33 | _tsym = &_tsym_ascii; | |
34 | ||
35 | /* Default */ | |
36 | @@ -1496,7 +1497,9 @@ | |
93de1115 JK |
37 | memset(&_values, 0, sizeof(_values)); |
38 | ||
39 | namebase = strdup((*argv)[0]); | |
40 | - base = basename(namebase); | |
41 | + base = strrchr(namebase,'/'); | |
42 | + if (base != NULL) *base++ = 0; | |
43 | + else base = namebase; | |
44 | ||
45 | if (!strcmp(base, "devmap_name")) { | |
46 | free(namebase); | |
a61b39d0 AM |
47 | @@ -1619,7 +1622,9 @@ |
48 | struct command *c; | |
49 | int r = 1; | |
50 | ||
51 | +#ifndef __KLIBC__ | |
52 | (void) setlocale(LC_ALL, ""); | |
53 | +#endif | |
54 | ||
55 | if (!_process_switches(&argc, &argv)) { | |
56 | fprintf(stderr, "Couldn't process command line.\n"); | |
57 | diff -urN device-mapper.1.02.05.org/lib/ioctl/libdm-iface.c device-mapper.1.02.05/lib/ioctl/libdm-iface.c | |
c97ab21d | 58 | --- device-mapper.1.02.05.org/lib/ioctl/libdm-iface.c 2006-04-03 17:56:02.000000000 +0200 |
a61b39d0 | 59 | +++ device-mapper.1.02.05/lib/ioctl/libdm-iface.c 2006-04-22 20:55:32.442643250 +0200 |
c97ab21d | 60 | @@ -135,17 +135,25 @@ |
93de1115 JK |
61 | uint32_t *number) |
62 | { | |
63 | FILE *fl; | |
64 | - char nm[256]; | |
93de1115 | 65 | + char nm[256], buf[300]; |
c97ab21d AM |
66 | int c; |
67 | - uint32_t num; | |
68 | + uint32_t num, size; | |
93de1115 JK |
69 | |
70 | if (!(fl = fopen(file, "r"))) { | |
71 | log_error("%s: fopen failed: %s", file, strerror(errno)); | |
72 | return 0; | |
73 | } | |
74 | ||
75 | - while (!feof(fl)) { | |
c97ab21d | 76 | - if (fscanf(fl, "%d %255s\n", &num, &nm[0]) == 2) { |
93de1115 JK |
77 | + /* Use fread+sscanf for klibc compatibility. */ |
78 | + do { | |
79 | + size = 0; | |
80 | + do { | |
81 | + num = fread(&buf[size], sizeof(char), 1, fl); | |
82 | + if (num > 0) | |
83 | + size++; | |
84 | + } while (num > 0 && buf[size - 1] != '\n'); | |
85 | + buf[size] = '\0'; | |
86 | + if (sscanf(buf, "%d %255s\n", number, &nm[0]) == 2) { | |
87 | if (!strcmp(name, nm)) { | |
c97ab21d AM |
88 | if (number) { |
89 | *number = num; | |
90 | @@ -154,10 +162,8 @@ | |
91 | } | |
92 | dm_bit_set(_dm_bitset, num); | |
93de1115 JK |
93 | } |
94 | - } else do { | |
95 | - c = fgetc(fl); | |
96 | - } while (c != EOF && c != '\n'); | |
97 | - } | |
98 | + } | |
99 | + } while (num > 0); | |
100 | fclose(fl); | |
101 | ||
c97ab21d | 102 | if (number) { |
a61b39d0 | 103 | diff -urN device-mapper.1.02.05.org/lib/libdm-file.c device-mapper.1.02.05/lib/libdm-file.c |
c97ab21d | 104 | --- device-mapper.1.02.05.org/lib/libdm-file.c 2006-01-31 15:50:37.000000000 +0100 |
a61b39d0 | 105 | +++ device-mapper.1.02.05/lib/libdm-file.c 2006-04-22 20:55:32.446643500 +0200 |
c97ab21d | 106 | @@ -16,10 +16,16 @@ |
93de1115 JK |
107 | #include "lib.h" |
108 | #include "libdm-file.h" | |
109 | ||
110 | -#include <sys/file.h> | |
111 | #include <fcntl.h> | |
112 | #include <dirent.h> | |
113 | ||
93de1115 JK |
114 | +#ifndef __KLIBC__ |
115 | +# include <sys/file.h> | |
116 | +# ifdef linux | |
117 | +# include <malloc.h> | |
118 | +# endif | |
c97ab21d AM |
119 | +#endif |
120 | + | |
93de1115 | 121 | static int _create_dir_recursive(const char *dir) |
c97ab21d AM |
122 | { |
123 | char *orig, *s; |