]> git.ipfire.org Git - thirdparty/asterisk.git/commit
stasis_recording/stored: remove calls to deprecated readdir_r function. 24/4224/7
authorKevin Harwell <kharwell@digium.com>
Fri, 28 Oct 2016 20:11:35 +0000 (15:11 -0500)
committerKevin Harwell <kharwell@digium.com>
Fri, 4 Nov 2016 18:58:21 +0000 (13:58 -0500)
commitbd4d7d8ad05bbe8d86b89429dfa55fbc3a0c108d
tree5da8f30e8611577b74ed2f1237d1e1407b73fc27
parent57a9797e0ac51eae3b8f3254627646b9698a60d2
stasis_recording/stored: remove calls to deprecated readdir_r function.

The readdir_r function has been deprecated and should no longer be used. This
patch removes the readdir_r dependency (replaced it with readdir) and also moves
the directory search code to a more centralized spot (file.c)

Also removed a strict dependency on the dirent structure's d_type field as it
is not portable. The code now checks to see if the value is available. If so,
it tries to use it, but defaults back to using the stats function if necessary.

Lastly, for most implementations of readdir it *should* be thread-safe to make
concurrent calls to it as long as different directory streams are specified.
glibc falls into this category. However, since it is possible that there exist
some implementations that are not safe, locking has been added for those other
than glibc.

ASTERISK-26412
ASTERISK-26509 #close

Change-Id: Id8f54689b1e2873e82a09d0d0d2faf41964e80ba
include/asterisk/file.h
main/file.c
res/stasis_recording/stored.c
tests/test_file.c [new file with mode: 0644]