]> git.ipfire.org Git - thirdparty/elfutils.git/commit
Remove usage of "unlocked" variant of stdio print functions
authorMichael Pratt <mcpratt@pm.me>
Wed, 16 Oct 2024 19:53:52 +0000 (19:53 +0000)
committerMark Wielaard <mark@klomp.org>
Thu, 17 Oct 2024 12:53:58 +0000 (14:53 +0200)
commit12d58cf3e30dee91ed7aadb6475a15c6e74cc88b
tree11ec7902bdb28cbe305d4e104628f29882b0a324
parentf8999be1101cca767785ea5a26873184d189c297
Remove usage of "unlocked" variant of stdio print functions

These "unlocked" Linux Standard Base variants of standard functions
are not available on some systems that are still capable
of building Linux and ELFs.

The difference is negligible for simple printing to stdout.

POSIX also states for the similar putc_unlocked():

  These functions can safely be used in a multi-threaded program
  if and only if they are called while the invoking thread owns
  the (FILE *) object, as is the case after a successful call
  to the flockfile() or ftrylockfile() functions.

...

  These unlocked versions can be safely used
  only within explicitly locked program regions,
  using exported locking primitives.

and these precautions were never done.

Use the standard forms of these print functions.

There is inconsistent use of fputc_unlocked() with putc_unlocked(),
so consistently use the safer fputc() instead.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
libasm/asm_align.c
libcpu/i386_parse.y
libebl/eblobjnote.c
src/nm.c
src/objdump.c
src/readelf.c
src/size.c
src/strings.c
tests/showptable.c