summaryrefslogtreecommitdiff
path: root/ext/mime_magic
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-30 15:13:33 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-30 15:13:33 +0000
commit55ebcb9f7e5caa31d22fc98b43312e817c33bad9 (patch)
tree2dacb7ddd8a77b3601bc2165b99f66acd10b5914 /ext/mime_magic
parentb0f688006df8f2ff591cd68b8debe9c34b44c206 (diff)
downloadphp-git-55ebcb9f7e5caa31d22fc98b43312e817c33bad9.tar.gz
MFB: Use thread-safe code
Diffstat (limited to 'ext/mime_magic')
-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 3bd1b21796..91453e7c46 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();