summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-01-04 21:04:27 +0000
committerJim Meyering <jim@meyering.net>2004-01-04 21:04:27 +0000
commit69ae5cff2a135c0e27f2fcad882c8ba415e91f5d (patch)
treed072e578888c793225c4856339c9589e78850252 /src
parent45c0d30e1d196c6461a3645c698c1553f89b3eb7 (diff)
downloadcoreutils-69ae5cff2a135c0e27f2fcad882c8ba415e91f5d.tar.xz
(copy_internal): Use ASSIGN_STRDUPA rather than alloca and strcpy.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/copy.c b/src/copy.c
index 2ccba222a..29c41653b 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1,5 +1,5 @@
/* copy.c -- core functions for copying files and directories
- Copyright (C) 89, 90, 91, 1995-2003 Free Software Foundation.
+ Copyright (C) 89, 90, 91, 1995-2004 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1036,8 +1036,11 @@ copy_internal (const char *src_path, const char *dst_path,
return 1;
}
- dst_backup = alloca (strlen (tmp_backup) + 1);
- strcpy (dst_backup, tmp_backup);
+ /* Using alloca for a pathname that may be (in theory) arbitrarily
+ long is not recommended. In fact, even forming such a name
+ should be discouraged. Eventually, this code will be rewritten
+ to use fts, so using alloca here will be less of a problem. */
+ ASSIGN_STRDUPA (dst_backup, tmp_backup);
free (tmp_backup);
if (rename (dst_path, dst_backup))
{