]> git.ipfire.org Git - thirdparty/asterisk.git/commit
file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type 40/4840/1
authorGeorge Joseph <gjoseph@digium.com>
Tue, 15 Nov 2016 18:01:04 +0000 (11:01 -0700)
committerKevin Harwell <kharwell@digium.com>
Fri, 27 Jan 2017 16:56:50 +0000 (10:56 -0600)
commit0d07070791c1b697aa37c2cc0ffc9a2608234fec
tree5b85ca306bcbbf9a0aefaef15d3e1ea4890d5700
parent7fc8b73f5c6c74e741fc7e3a9351ecfc0daee372
file.c/__ast_file_read_dirs:  Fix issues on filesystems without d_type

One of the code paths in __ast_file_read_dirs will only get executed if
the OS doesn't support dirent->d_type OR if the filesystem the
particular file is on doesn't support it.  So, while standard Linux
systems support the field, some filesystems like XFS do not.  In this
case, we need to call stat() to determine whether the directory entry
is a file or directory so we append the filename to the supplied
directory path and call stat.  We forgot to truncate path back to just
the directory afterwards though so we were passing a complete file name
to the callback in the dir_name parameter instead of just the directory
name.

The logic has been re-written to only create a full_path if we need to
call stat() or if we need to descend into another directory.

Change-Id: I54e4228bd8355fad65200c6df3ec4c9c8a98dfba
main/file.c
tests/test_file.c