summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-30 15:13:19 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-30 15:13:19 +0000
commit20b92bf4ccb82edd5487f70d2736c65deb3b22f5 (patch)
tree4ef3e27c7efb7689d1920791b4b2f419d4a7d354
parent57130c653a6cbec5c776bf76db484a2d9f6ee2fa (diff)
downloadphp-git-20b92bf4ccb82edd5487f70d2736c65deb3b22f5.tar.gz
Use thread-safe code
-rw-r--r--ext/mime_magic/mime_magic.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c
index d4ef4dbec0..c4a4ebaf24 100644
--- a/ext/mime_magic/mime_magic.c
+++ b/ext/mime_magic/mime_magic.c
@@ -1755,12 +1755,15 @@ static void mprint(union VALUETYPE *p, struct magic *m)
case DATE:
case BEDATE:
case LEDATE:
- /* XXX: not multithread safe */
- pp = ctime((time_t *) & p->l);
- if ((rt = strchr(pp, '\n')) != NULL)
- *rt = '\0';
- (void) magic_rsl_printf(m->desc, pp);
- return;
+ {
+ char ctimebuf[52];
+ pp = php_ctime_r((time_t *) &p->l, ctimebuf);
+ if ((rt = strchr(pp, '\n')) != NULL) {
+ *rt = '\0';
+ }
+ (void) magic_rsl_printf(m->desc, pp);
+ return;
+ }
default:
{
TSRMLS_FETCH();