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