summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-01-04 21:07:16 +0000
committerJim Meyering <jim@meyering.net>2004-01-04 21:07:16 +0000
commit68eb5f3e0d6b1c8eb70ae107bc06799da726019a (patch)
tree4f2e0f133687523da58384bccf8c1d77f770aad8
parent69ae5cff2a135c0e27f2fcad882c8ba415e91f5d (diff)
downloadcoreutils-68eb5f3e0d6b1c8eb70ae107bc06799da726019a.tar.gz
coreutils-68eb5f3e0d6b1c8eb70ae107bc06799da726019a.tar.bz2
coreutils-68eb5f3e0d6b1c8eb70ae107bc06799da726019a.zip
(re_protect): Use ASSIGN_STRDUPA rather than alloca and strcpy.
(make_path_private): Likewise.
-rw-r--r--src/cp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cp.c b/src/cp.c
index e92d819dd..48ece6a89 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -285,8 +285,7 @@ re_protect (const char *const_dst_path, int src_offset,
char *src_path; /* The source name in `dst_path'. */
uid_t myeuid = geteuid ();
- dst_path = alloca (strlen (const_dst_path) + 1);
- strcpy (dst_path, const_dst_path);
+ ASSIGN_STRDUPA (dst_path, const_dst_path);
src_path = dst_path + src_offset;
for (p = attr_list; p; p = p->next)
@@ -383,8 +382,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
char *dst_dirname; /* Leading path of `dirpath'. */
size_t dirlen; /* Length of leading path of `dirpath'. */
- dirpath = alloca (strlen (const_dirpath) + 1);
- strcpy (dirpath, const_dirpath);
+ ASSIGN_STRDUPA (dirpath, const_dirpath);
src = dirpath + src_offset;