projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2673ec6
)
[project @ 2006-01-12 12:41:03 by simonmar]
author
simonmar
<unknown>
Thu, 12 Jan 2006 12:41:03 +0000
(12:41 +0000)
committer
simonmar
<unknown>
Thu, 12 Jan 2006 12:41:03 +0000
(12:41 +0000)
time_str:
- use ctime_r if available
- avoid use of strcpy on overlapping regions
Ticket #480 (patch modified by me)
ghc/rts/RtsUtils.c
patch
|
blob
|
history
diff --git
a/ghc/rts/RtsUtils.c
b/ghc/rts/RtsUtils.c
index
b54d3da
..
ef7cbb7
100644
(file)
--- a/
ghc/rts/RtsUtils.c
+++ b/
ghc/rts/RtsUtils.c
@@
-189,9
+189,13
@@
time_str(void)
if (now == 0) {
time(&now);
+#if HAVE_CTIME_R
+ ctime_r(&now, nowstr);
+#else
strcpy(nowstr, ctime(&now));
- strcpy(nowstr+16,nowstr+19);
- nowstr[21] = '\0';
+#endif
+ memmove(nowstr+16,nowstr+19,7);
+ nowstr[21] = '\0'; // removes the \n
}
return nowstr;
}