diff options
author | Miles Bader <miles@gnu.org> | 1997-07-29 20:42:05 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-07-29 20:42:05 +0000 |
commit | e3aa713f35d2da5c043faefa21f312c48a10b606 (patch) | |
tree | 13356eaf0c4bda7c2e2edf42aebaeee02ddbeff4 /utils/ftpcp.c | |
parent | dfa4e74d487e4ae241eaadcd09e22b1fac40c805 (diff) |
(main):
When mungeing the destination to copy into a directory, do the name used to
print error messages too.
Diffstat (limited to 'utils/ftpcp.c')
-rw-r--r-- | utils/ftpcp.c | 13 |
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); } |