Fix media scanning in case readdir() returns type DT_UNKNOWN.
In that case, a stat() fallback was present in the code. The stat() call, however, wasn't run on the file in question, but the containing directory. Consequently, the file was treated as a directory, which resulted in the scan being aborted due to opendir() failing. Example logcat output: D/MediaScanner( 2434): opendir /system/media/audio/alarms/Alarm_Beep_01.ogg/ failed, errno: 20 E/MediaScanner( 2434): Error processing '/system/media/audio/alarms/Alarm_Beep_01.ogg/' - skipping D/MediaScanner( 2434): stat() failed for /system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory D/MediaScanner( 2434): stat() failed for /system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory D/MediaScanner( 2434): stat() failed for /system/media/audio/alarms/Alarm_Beep_01.ogg/: Not a directory [...] Fix that issue by amending the file name to the buffer prior to calling stat().
Loading
Please register or sign in to comment