summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-07-29 20:42:05 +0000
committerMiles Bader <miles@gnu.org>1997-07-29 20:42:05 +0000
commite3aa713f35d2da5c043faefa21f312c48a10b606 (patch)
tree13356eaf0c4bda7c2e2edf42aebaeee02ddbeff4 /utils
parentdfa4e74d487e4ae241eaadcd09e22b1fac40c805 (diff)
(main):
When mungeing the destination to copy into a directory, do the name used to print error messages too.
Diffstat (limited to 'utils')
-rw-r--r--utils/ftpcp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/utils/ftpcp.c b/utils/ftpcp.c
index 92bcabf2..a11f0164 100644
--- a/utils/ftpcp.c
+++ b/utils/ftpcp.c
@@ -308,15 +308,16 @@ main (int argc, char **argv)
char *bname = basename (rd.file);
size_t bname_len = strlen (bname);
char *dir = wr.file;
- char *name = malloc (strlen (dir) + 1 + bname_len + 1);
+ char *file = malloc (strlen (dir) + 1 + bname_len + 1);
+ char *name = malloc (strlen (wr.name) + 1 + bname_len + 1);
- if (! name)
+ if (!file || !name)
error (99, ENOMEM, "%s", dir);
- strcpy (name, dir);
- strcat (name, "/");
- strcat (name, bname);
- wr.file = name;
+ stpcpy (stpcpy (stpcpy (file, dir), "/"), bname);
+ wr.file = file;
+ stpcpy (stpcpy (stpcpy (name, wr.name), "/"), bname);
+ wr.name = name;
err = eopen_wr (&wr, &wr_fd);
}