]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-LFS.patch
- updated
[packages/busybox.git] / busybox-LFS.patch
1 diff -Nur busybox-1.00/include/libbb.h.orig busybox-1.00/include/libbb.h
2 --- busybox-1.00/include/libbb.h.orig   2005-02-15 16:48:07.491412688 +0100
3 +++ busybox-1.00/include/libbb.h        2005-02-15 16:40:15.000000000 +0100
4 @@ -137,8 +137,8 @@
5  extern char *find_real_root_device_name(void);
6  extern char *bb_get_line_from_file(FILE *file);
7  extern char *bb_get_chomped_line_from_file(FILE *file);
8 -extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
9 -extern int bb_copyfd_eof(int fd1, int fd2);
10 +extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size);
11 +extern off_t bb_copyfd_eof(int fd1, int fd2);
12  extern void  bb_xprint_and_close_file(FILE *file);
13  extern int   bb_xprint_file_by_name(const char *filename);
14  extern char  bb_process_escape_sequence(const char **ptr);
15 @@ -193,6 +193,8 @@
16  extern int safe_strtod(char *arg, double* value);
17  extern int safe_strtol(char *arg, long* value);
18  extern int safe_strtoul(char *arg, unsigned long* value);
19 +extern int safe_strtoll(char *arg, long long* value);
20 +extern int safe_strtoull(char *arg, unsigned long long* value);
21  
22  struct suffix_mult {
23         const char *suffix;
24 diff -Nur busybox-1.00/libbb/copyfd.c.orig busybox-1.00/libbb/copyfd.c
25 --- busybox-1.00/libbb/copyfd.c.orig    2005-02-15 16:48:45.561625136 +0100
26 +++ busybox-1.00/libbb/copyfd.c 2005-02-15 16:39:24.000000000 +0100
27 @@ -34,9 +34,9 @@
28  
29  
30  /* If size is 0 copy until EOF */
31 -static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size)
32 +static off_t bb_full_fd_action(int src_fd, int dst_fd, const off_t size)
33  {
34 -       size_t read_total = 0;
35 +       off_t read_total = 0;
36         RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
37  
38         while ((size == 0) || (read_total < size)) {
39 @@ -76,7 +76,7 @@
40  }
41  
42  
43 -extern int bb_copyfd_size(int fd1, int fd2, const off_t size)
44 +extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size)
45  {
46         if (size) {
47                 return(bb_full_fd_action(fd1, fd2, size));
48 @@ -84,7 +84,7 @@
49         return(0);
50  }
51  
52 -extern int bb_copyfd_eof(int fd1, int fd2)
53 +extern off_t bb_copyfd_eof(int fd1, int fd2)
54  {
55         return(bb_full_fd_action(fd1, fd2, 0));
56  }
57 diff -Nur busybox-1.00-orig/libbb/Makefile.in busybox-1.00/libbb/Makefile.in
58 --- busybox-1.00-orig/libbb/Makefile.in 2004-10-08 09:45:31.000000000 +0200
59 +++ busybox-1.00/libbb/Makefile.in      2005-02-15 10:51:08.585581312 +0100
60 @@ -72,7 +72,7 @@
61         xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
62  
63  LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
64 -LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
65 +LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o safe_strtoull.o safe_strtoll.o
66  
67  LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
68  LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
69 diff -Nur busybox-1.00-orig/libbb/safe_strtol.c busybox-1.00/libbb/safe_strtol.c
70 --- busybox-1.00-orig/libbb/safe_strtol.c       2004-03-06 23:11:45.000000000 +0100
71 +++ busybox-1.00/libbb/safe_strtol.c    2005-02-15 10:53:56.546047440 +0100
72 @@ -90,3 +90,38 @@
73  }
74  #endif
75  
76 +#ifdef L_safe_strtoll
77 +extern
78 +int safe_strtoll(char *arg, long long* value)
79 +{
80 +       char *endptr;
81 +       int errno_save = errno;
82 +
83 +       assert(arg!=NULL);
84 +       errno = 0;
85 +       *value = strtoll(arg, &endptr, 0);
86 +       if (errno != 0 || *endptr!='\0' || endptr==arg) {
87 +               return 1;
88 +       }
89 +       errno = errno_save;
90 +       return 0;
91 +}
92 +#endif
93 +
94 +#ifdef L_safe_strtoull
95 +extern
96 +int safe_strtoull(char *arg, unsigned long long* value)
97 +{
98 +       char *endptr;
99 +       int errno_save = errno;
100 +
101 +       assert(arg!=NULL);
102 +       errno = 0;
103 +       *value = strtoull(arg, &endptr, 0);
104 +       if (errno != 0 || *endptr!='\0' || endptr==arg) {
105 +               return 1;
106 +       }
107 +       errno = errno_save;
108 +       return 0;
109 +}
110 +#endif
111 diff -Nur busybox-1.00-orig/networking/ftpgetput.c busybox-1.00/networking/ftpgetput.c
112 --- busybox-1.00-orig/networking/ftpgetput.c    2004-05-04 12:43:34.000000000 +0200
113 +++ busybox-1.00/networking/ftpgetput.c 2005-02-15 11:02:41.127298968 +0100
114 @@ -152,8 +152,12 @@
115         fd_data = xconnect_ftpdata(server, buf);
116  
117         if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
118 -               unsigned long value=filesize;
119 -               if (safe_strtoul(buf + 4, &value))
120 +               off_t value=filesize;
121 +#ifdef CONFIG_LFS
122 +               if (safe_strtoull(buf + 4, &value))
123 +#else
124 +               if (safe_strtoull(buf + 4, &value))
125 +#endif
126                         bb_error_msg_and_die("SIZE error: %s", buf + 4);
127                 filesize = value;
128         }
129 @@ -240,7 +244,11 @@
130                 fd_local = bb_xopen(local_path, O_RDONLY);
131                 fstat(fd_local, &sbuf);
132  
133 +#ifdef CONFIG_LFS
134 +               sprintf(buf, "ALLO %llu", (unsigned long long)sbuf.st_size);
135 +#else
136                 sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
137 +#endif
138                 response = ftpcmd(buf, NULL, control_stream, buf);
139                 switch (response) {
140                 case 200:
141 diff -Nur busybox-1.00-orig/networking/wget.c busybox-1.00/networking/wget.c
142 --- busybox-1.00-orig/networking/wget.c 2004-10-08 10:27:40.000000000 +0200
143 +++ busybox-1.00/networking/wget.c      2005-02-15 11:33:10.235232296 +0100
144 @@ -389,8 +389,12 @@
145                          */
146                         while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
147                                 if (strcasecmp(buf, "content-length") == 0) {
148 -                                       unsigned long value;
149 +                                       off_t value;
150 +#ifdef CONFIG_LFS
151 +                                       if (safe_strtoull(s, &value)) {
152 +#else
153                                         if (safe_strtoul(s, &value)) {
154 +#endif
155                                                 close_delete_and_die("content-length %s is garbage", s);
156                                         }
157                                         filesize = value;
158 @@ -460,8 +464,12 @@
159                  * Querying file size
160                  */
161                 if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) {
162 -                       unsigned long value;
163 +                       off_t value;
164 +#ifdef CONFIG_LFS
165 +                       if (safe_strtoull(buf+4, &value)) {
166 +#else
167                         if (safe_strtoul(buf+4, &value)) {
168 +#endif
169                                 close_delete_and_die("SIZE value is garbage");
170                         }
171                         filesize = value;
172 @@ -502,7 +510,12 @@
173          */
174         if (chunked) {
175                 fgets(buf, sizeof(buf), dfp);
176 +#ifdef CONFIG_LFS
177 +               filesize = strtoll(buf, (char **) NULL, 16);
178 +#else
179                 filesize = strtol(buf, (char **) NULL, 16);
180 +#endif
181 +
182         }
183  #ifdef CONFIG_FEATURE_WGET_STATUSBAR
184         if (quiet_flag==FALSE)
185 @@ -524,7 +537,11 @@
186                 if (chunked) {
187                         safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */
188                         safe_fgets(buf, sizeof(buf), dfp);
189 +#ifdef CONFIG_LFS
190 +                       filesize = strtoll(buf, (char **) NULL, 16);
191 +#else
192                         filesize = strtol(buf, (char **) NULL, 16);
193 +#endif
194                         if (filesize==0) {
195                                 chunked = 0; /* all done! */
196                         }
This page took 0.078942 seconds and 4 git commands to generate.