* error.c (scm_strerror): Use scm_i_misc_mutex around strerror since it's not thread safe. (scm_syserror): Use scm_strerror rather than SCM_I_STRERROR, to take advantage of this. * fports.c (scm_open_file): Use scm_strerror likewise. * filesys.c (scm_stat, scm_lstat): Ditto. A program provoking the problem (in glibc at least), (use-modules (ice-9 threads)) (define e1 9999) (define s1 (strerror e1)) (define e2 7777) (define s2 (strerror e2)) (begin-thread (while #t (display "-") (let ((s (strerror e1))) (if (not (string=? s1 s)) (begin (format #t "oops, wrong s1, got ~s want ~s\n" s s1) (primitive-exit 1)))))) (while #t (display ".") (let ((s (strerror e2))) (if (not (string=? s2 s)) (begin (format #t "oops, wrong s2, got ~s want ~s\n" s s2) (primitive-exit 1)))))