On 04/24/2014 07:21 AM, Stefan Hajnoczi wrote:
>> +static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
>> +{
>> + struct dirent *entry;
>> + DIR *dir;
>> +
>> + o->nchildren = 0;
>> + dir = opendir(o->path);
>> + if (!dir) {
>> + return;
>> + }
>> + while ((entry = readdir(dir)) != NULL) {
>
> Please use the reentrant readdir_r() so we don't have to worry later on
> when removing the QEMU global mutex.readdir_r() is absolute trash. There is no safe way to know how large to size the buffer. POSIX is considering withdrawing it as useless, on the grounds that readdir() is already thread-safe insofar as no two threads share the same DIR*. http://austingroupbugs.net/view.php?id=696 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
