]> git.pld-linux.org Git - packages/busybox.git/blame - busybox-ftpput.patch
- 1.01
[packages/busybox.git] / busybox-ftpput.patch
CommitLineData
0deeb6ff 1--- busybox-1.00/networking/ftpgetput.c.orig 2005-02-15 13:30:36.000000000 +0100
2+++ busybox-1.00/networking/ftpgetput.c 2005-02-15 14:00:35.315575696 +0100
3@@ -227,15 +227,51 @@
4 int fd_local;
5 int response;
6
7+ int server_sl = -1;
8+ int local_sl = -1;
9+ char local_fname[512];
10+ char server_fname[512];
11+ char server_fpath[1024];
12+ char *temp;
13+ int i;
14+
15+ strcpy (server_fpath, server_path);
16+
17+ for (i = 0; server_fpath[i] != '\0'; i++)
18+ if (server_fpath[i] == '/') server_sl = i;
19+
20+ if (server_sl == -1) {
21+ strcpy(server_fname, server_fpath);
22+ server_fpath[0] = '\0';
23+ } else {
24+ temp = server_fpath + server_sl;
25+ strcpy(server_fname, temp);
26+ server_fpath[server_sl+1] = '\0';
27+ }
28+
29+ for (i = 0; local_path[i] != '\0'; i++)
30+ if (local_path[i] == '/') local_sl = i;
31+
32+ if (local_sl == -1) {
33+ strcpy(local_fname, local_path);
34+ } else {
35+ temp = local_path + local_sl;
36+ strcpy(local_fname, temp);
37+ }
38+
39+ if (server_fname[0] == '\0')
40+ strcpy (server_fname, local_fname);
41+
42 /* Connect to the data socket */
43 if (ftpcmd("PASV", NULL, control_stream, buf) != 227) {
44 bb_error_msg_and_die("PASV error: %s", buf + 4);
45 }
46 fd_data = xconnect_ftpdata(server, buf);
47
48- if (ftpcmd("CWD ", server_path, control_stream, buf) != 250) {
49- bb_error_msg_and_die("CWD error: %s", buf + 4);
50- }
51+ if (server_sl != -1)
52+ if (ftpcmd("CWD ", server_fpath, control_stream, buf) != 250) {
53+ bb_error_msg_and_die("CWD error: %s", buf + 4);
54+ }
55
56 /* get the local file */
57 if ((local_path[0] == '-') && (local_path[1] == '\0')) {
58@@ -260,7 +296,7 @@
59 break;
60 }
61 }
62- response = ftpcmd("STOR ", local_path, control_stream, buf);
63+ response = ftpcmd("STOR ", server_fname, control_stream, buf);
64 switch (response) {
65 case 125:
66 case 150:
This page took 0.037143 seconds and 4 git commands to generate.