]> git.pld-linux.org Git - packages/device-mapper.git/blob - device-mapper-klibc.patch
- tabs in preamble
[packages/device-mapper.git] / device-mapper-klibc.patch
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.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
64 @@ -135,17 +135,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_error("%s: fopen failed: %s", file, strerror(errno));
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 @@ -155,10 +163,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_error("%s: fclose failed: %s", file, strerror(errno));
107  
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
110 @@ -16,10 +16,16 @@
111  #include "lib.h"
112  #include "libdm-file.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;
This page took 0.588341 seconds and 3 git commands to generate.