]> git.pld-linux.org Git - packages/device-mapper.git/blob - device-mapper-klibc.patch
3503c85d34d4ad4c5cfca43ed872f296c06c95f0
[packages/device-mapper.git] / device-mapper-klibc.patch
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
4 @@ -66,7 +66,7 @@
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  
11  AC_CHECK_HEADERS(termios.h)
12  ################################################################################
13 diff -urN device-mapper.1.02.05.org/dmsetup/dmsetup.c device-mapper.1.02.05/dmsetup/dmsetup.c
14 --- device-mapper.1.02.05.org/dmsetup/dmsetup.c 2006-04-06 18:20:40.000000000 +0200
15 +++ device-mapper.1.02.05/dmsetup/dmsetup.c     2006-04-22 20:55:57.180189250 +0200
16 @@ -29,7 +29,6 @@
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>
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 @@
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);
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
58 --- device-mapper.1.02.05.org/lib/ioctl/libdm-iface.c   2006-04-03 17:56:02.000000000 +0200
59 +++ device-mapper.1.02.05/lib/ioctl/libdm-iface.c       2006-04-22 20:55:32.442643250 +0200
60 @@ -135,17 +135,25 @@
61                             uint32_t *number)
62  {
63         FILE *fl;
64 -       char nm[256];
65 +       char nm[256], buf[300];
66         int c;
67 -       uint32_t num;
68 +       uint32_t num, size;
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)) {
76 -               if (fscanf(fl, "%d %255s\n", &num, &nm[0]) == 2) {
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", &num, &nm[0]) == 2) {
87                         if (!strcmp(name, nm)) {
88                                 if (number) {
89                                         *number = num;
90 @@ -154,10 +162,8 @@
91                                 }
92                                 dm_bit_set(_dm_bitset, num);
93                         }
94 -               } else do {
95 -                       c = fgetc(fl);
96 -               } while (c != EOF && c != '\n');
97 -       }
98 +               }
99 +       } while (size > 0);
100         fclose(fl);
101  
102         if (number) {
103 diff -urN device-mapper.1.02.05.org/lib/libdm-file.c device-mapper.1.02.05/lib/libdm-file.c
104 --- device-mapper.1.02.05.org/lib/libdm-file.c  2006-01-31 15:50:37.000000000 +0100
105 +++ device-mapper.1.02.05/lib/libdm-file.c      2006-04-22 20:55:32.446643500 +0200
106 @@ -16,10 +16,16 @@
107  #include "lib.h"
108  #include "libdm-file.h"
109  
110 -#include <sys/file.h>
111  #include <fcntl.h>
112  #include <dirent.h>
113  
114 +#ifndef __KLIBC__
115 +#  include <sys/file.h>
116 +#  ifdef linux
117 +#    include <malloc.h>
118 +#  endif
119 +#endif
120 +
121  static int _create_dir_recursive(const char *dir)
122  {
123         char *orig, *s;
This page took 0.023332 seconds and 2 git commands to generate.