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