]> git.pld-linux.org Git - packages/device-mapper.git/blame - device-mapper-klibc.patch
- tabs in preamble
[packages/device-mapper.git] / device-mapper-klibc.patch
CommitLineData
b5f876a1 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 @@
93de1115
JK
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
c97ab21d 10 AC_CHECK_HEADERS(termios.h)
93de1115 11 ################################################################################
b5f876a1 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 @@
93de1115
JK
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>
b5f876a1 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 @@
a61b39d0
AM
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 */
b5f876a1 41@@ -1647,7 +1650,9 @@
93de1115
JK
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);
b5f876a1 52@@ -1783,7 +1788,9 @@
a61b39d0
AM
53 struct command *c;
54 int r = 1;
55
56+#ifndef __KLIBC__
d2a9d666 57 (void) setlocale(LC_ALL, "");
a61b39d0
AM
58+#endif
59
60 if (!_process_switches(&argc, &argv)) {
61 fprintf(stderr, "Couldn't process command line.\n");
b5f876a1 62--- device-mapper.1.02.09.orig/lib/ioctl/libdm-iface.c 2006-08-08 21:22:31.000000000 +0000
63+++ device-mapper.1.02.09.klibc/lib/ioctl/libdm-iface.c 2006-09-27 18:22:22.000000000 +0000
c97ab21d 64@@ -135,17 +135,25 @@
93de1115
JK
65 uint32_t *number)
66 {
67 FILE *fl;
68- char nm[256];
93de1115 69+ char nm[256], buf[300];
c97ab21d
AM
70 int c;
71- uint32_t num;
72+ uint32_t num, size;
93de1115
JK
73
74 if (!(fl = fopen(file, "r"))) {
75 log_error("%s: fopen failed: %s", file, strerror(errno));
76 return 0;
77 }
78
79- while (!feof(fl)) {
c97ab21d 80- if (fscanf(fl, "%d %255s\n", &num, &nm[0]) == 2) {
93de1115
JK
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';
35dd99f6 90+ if (sscanf(buf, "%d %255s\n", &num, &nm[0]) == 2) {
93de1115 91 if (!strcmp(name, nm)) {
c97ab21d
AM
92 if (number) {
93 *number = num;
2ecb94af 94@@ -155,10 +163,9 @@
c97ab21d
AM
95 }
96 dm_bit_set(_dm_bitset, num);
93de1115
JK
97 }
98- } else do {
99- c = fgetc(fl);
100- } while (c != EOF && c != '\n');
101- }
2ecb94af 102+ }
35dd99f6 103+ } while (size > 0);
2ecb94af 104+
105 if (fclose(fl))
106 log_error("%s: fclose failed: %s", file, strerror(errno));
93de1115 107
b5f876a1 108--- device-mapper.1.02.09.orig/lib/libdm-file.c 2006-05-10 16:23:41.000000000 +0000
109+++ device-mapper.1.02.09.klibc/lib/libdm-file.c 2006-09-27 18:22:22.000000000 +0000
c97ab21d 110@@ -16,10 +16,16 @@
93de1115
JK
111 #include "lib.h"
112 #include "libdm-file.h"
113
114-#include <sys/file.h>
115 #include <fcntl.h>
116 #include <dirent.h>
117
93de1115
JK
118+#ifndef __KLIBC__
119+# include <sys/file.h>
120+# ifdef linux
121+# include <malloc.h>
122+# endif
c97ab21d
AM
123+#endif
124+
93de1115 125 static int _create_dir_recursive(const char *dir)
c97ab21d
AM
126 {
127 char *orig, *s;
This page took 0.081706 seconds and 4 git commands to generate.