summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c39
-rw-r--r--elf/dl-lookup.c4
-rw-r--r--elf/dl-profile.c2
3 files changed, 22 insertions, 23 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 9a6aae6a93..0b752676b7 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -238,12 +238,12 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
if (tmp == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, cp, len);
- memcpy (tmp + len, _dl_platform, _dl_platformlen);
- tmp[len + _dl_platformlen] = '/';
- tmp[len + _dl_platformlen + 1] = '\0';
-
dirp->dirname = tmp;
+ tmp = __mempcpy (tmp, cp, len);
+ tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+ *tmp++ = '/';
+ *tmp = '\0';
+
dirp->machdirstatus = dirp->dirstatus;
if (max_dirnamelen < dirp->machdirnamelen)
@@ -260,13 +260,11 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
if (tmp == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, cp, len);
- tmp[len] = '\0';
+ dirp->dirname = tmp;
+ *((char *) __mempcpy (tmp, cp, len)) = '\0';
if (max_dirnamelen < dirp->dirnamelen)
max_dirnamelen = dirp->dirnamelen;
-
- dirp->dirname = tmp;
}
dirp->next = all_dirs;
@@ -430,12 +428,11 @@ _dl_init_paths (void)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
- memcpy (tmp, relem->dirname, relem->dirnamelen);
- memcpy (tmp + relem->dirnamelen, _dl_platform, _dl_platformlen);
- tmp[relem->dirnamelen + _dl_platformlen] = '/';
- tmp[relem->dirnamelen + _dl_platformlen + 1] = '\0';
-
relem->dirname = tmp;
+ tmp = __mempcpy (tmp, relem->dirname, relem->dirnamelen);
+ tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+ *tmp++ = '/';
+ *tmp = '\0';
relem->machdirstatus = unknown;
@@ -812,9 +809,10 @@ open_path (const char *name, size_t namelen,
if (this_dir->machdirstatus != nonexisting)
{
/* Construct the pathname to try. */
- (void) memcpy (buf, this_dir->dirname, this_dir->machdirnamelen);
- (void) memcpy (buf + this_dir->machdirnamelen, name, namelen);
- buflen = this_dir->machdirnamelen + namelen;
+ buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+ this_dir->machdirnamelen),
+ name, namelen)
+ - buf);
fd = __open (buf, O_RDONLY);
if (this_dir->machdirstatus == unknown)
@@ -839,9 +837,10 @@ open_path (const char *name, size_t namelen,
if (fd == -1 && this_dir->dirstatus != nonexisting)
{
/* Construct the pathname to try. */
- (void) memcpy (buf, this_dir->dirname, this_dir->dirnamelen);
- (void) memcpy (buf + this_dir->dirnamelen, name, namelen);
- buflen = this_dir->dirnamelen + namelen;
+ buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+ this_dir->dirnamelen),
+ name, namelen)
+ - buf);
fd = __open (buf, O_RDONLY);
if (this_dir->dirstatus == unknown)
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index ef344794c5..c51724026e 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -355,8 +355,8 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
/* We could find no value for a strong reference. */
const size_t len = strlen (undef_name);
char buf[sizeof undefined_msg + len];
- memcpy (buf, undefined_msg, sizeof undefined_msg - 1);
- memcpy (&buf[sizeof undefined_msg - 1], undef_name, len + 1);
+ __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
+ undef_name, len + 1);
_dl_signal_error (0, reference_name, buf);
}
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index dcbbcd026e..1a4f6b3105 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -262,7 +262,7 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
fd = __open (filename, O_RDWR | O_CREAT, 0666);
if (fd == -1)
{
- /* We cannot write the profiling data so don't do anthing. */
+ /* We cannot write the profiling data so don't do anything. */
char buf[400];
_dl_sysdep_message (filename, ": cannot open file: ",
_strerror_internal (errno, buf, sizeof buf),