buffer = pthread_getspecific(fr_strerror_key);
if (!buffer) {
+ int ret;
+
buffer = malloc(FR_STRERROR_BUFSIZE);
if (!buffer) return; /* panic and die! */
-
- if (pthread_setspecific(fr_strerror_key, buffer) != 0) {
- fr_perror("Failed recording thread error");
+
+ ret = pthread_setspecific(fr_strerror_key, buffer);
+ if (ret != 0) {
+ fr_perror("Failed recording thread error: %s",
+ strerror(ret));
return;
}
static PerlInterpreter *rlm_perl_clone(PerlInterpreter *perl, pthread_key_t *key)
{
+ int ret;
+
PerlInterpreter *interp;
UV clone_flags = 0;
PERL_SET_CONTEXT(aTHX);
rlm_perl_clear_handles(aTHX);
- pthread_setspecific(*key, interp);
+ ret = pthread_setspecific(*key, interp);
+ if (ret != 0) {
+ radlog(L_DBG,"rlm_perl: Failed associating interpretor "
+ "with thread %s", strerror(ret));
+
+ rlm_perl_destruct(interp);
+ return NULL;
+ }
return interp;
}