about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-02 09:53:48 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-02 09:53:48 +0000
commit1e823b7d2dcbffb793be1e48b397d7c1a1b19a52 (patch)
tree8cc0a271fc0e62ba1ab2c31176210b0eae9e4312
parent379d4ec4970113f6b0945fe77c01834eea837868 (diff)
downloadglibc-1e823b7d2dcbffb793be1e48b397d7c1a1b19a52.tar.gz
glibc-1e823b7d2dcbffb793be1e48b397d7c1a1b19a52.tar.xz
glibc-1e823b7d2dcbffb793be1e48b397d7c1a1b19a52.zip
Update.
	* elf/dl-profile.c (_dl_start_profile): Help the compiler to avoid
	strncpy if possible.
-rw-r--r--ChangeLog3
-rw-r--r--elf/dl-profile.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8632fbac12..09e1265c0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-02-02  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-profile.c (_dl_start_profile): Help the compiler to avoid
+	strncpy if possible.
+
 	* sysdeps/generic/dl-environ.c (unsetenv): Optimize.  Don't use
 	strncmp.
 	* elf/dl-load.c (is_dst): Optimize.  Don't call strncmp twice.
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 6abdb1b76d..163a841d6f 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -244,7 +244,10 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
   *(char **) hist_hdr.high_pc = (char *) mapend;
   *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
   *(int32_t *) hist_hdr.prof_rate = __profile_frequency ();
-  strncpy (hist_hdr.dimen, "seconds", sizeof (hist_hdr.dimen));
+  if (sizeof (hist_hdr.dimen) >= sizeof ("seconds"))
+    memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds"));
+  else
+    strncpy (hist_hdr.dimen, "seconds", sizeof (hist_hdr.dimen));
   hist_hdr.dimen_abbrev = 's';
 
   /* First determine the output name.  We write in the directory