[Xapian-tickets] [Xapian] #665: Avoid C library functions not guaranteed to be thread-safe

Xapian nobody at xapian.org
Sun May 3 12:43:25 BST 2015


#665: Avoid C library functions not guaranteed to be thread-safe
-------------------------+--------------------------
 Reporter:  olly         |             Owner:  olly
     Type:  defect       |            Status:  new
 Priority:  normal       |         Milestone:  1.3.x
Component:  Library API  |           Version:  1.3.2
 Severity:  normal       |        Resolution:
 Keywords:               |        Blocked By:
 Blocking:               |  Operating System:  All
-------------------------+--------------------------

Comment (by olly):

 Functions which POSIX says are not required to be thread-safe which we're
 actually using in the library code in current master:

  * `getenv()` - used to read things like `XAPIAN_FLUSH_THRESHOLD`.
  * `inet_ntoa()` - used in the remote server code - while that's in the
 library, it's only actually used in binaries we build currently.
  * `readdir()` - used in replication code to delete the old replica -
 again, in the library but only used in binaries we build

 And `strerror()` is used, but only if neither `strerror_r()` nor
 `sys_errlist` are available.

 There's also at least `atoi()` and `strtod()` which the Linux man pages
 note aren't thread-safe if another thread calls `setlocale()` while they
 are executing.

--
Ticket URL: <http://trac.xapian.org/ticket/665#comment:3>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list