On 11/25/2010 04:51 AM, Rémi Denis-Courmont wrote: > strerror() is not thread-safe, nor in the glibc implementation, > nor in the POSIX specification. In my experience, it will infrequently > crash when another thread uses locale data in any way, including > string formatting and such... > > Since the Huawei driver uses thread, we might as well avoid strerror(). > --- > drivers/isimodem/sim.c | 3 ++- > plugins/hfp.c | 4 ++-- > plugins/isigen.c | 13 ++++++++----- > plugins/n900.c | 14 +++++++------- > plugins/nokia-gpio.c | 29 +++++++++++++++++------------ > 5 files changed, 36 insertions(+), 27 deletions(-) > Since we do not use threads, do you still want this patch? If you do, can you please break this up into two patches, one for drivers/isimodem and one for plugins? We prefer patches to be split by directory. > @@ -765,7 +767,10 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data) > if (addr) { > error = g_pn_netlink_set_address(idx, addr); > if (error && error != -EEXIST) > - DBG("g_pn_netlink_set_address: %s", strerror(-error)); > + { > + errno = -error; > + DBG("g_pn_netlink_set_address: %m"); > + } > } > > return 0; You might also want to fix the style violation above, the opening brace should be on the same line as the if statement. Regards, -Denis