Dmitry Timoshkov dmitry@baikal.ru writes:
Alexandre Julliard julliard@winehq.org wrote:
+static int is_directory_empty( struct fd *fd ) +{
- DIR *dir;
- int count = 0;
- if ((dir = fdopendir( fd->unix_fd )))
- {
while (readdir( dir ) != NULL && count <= 2)
count++;
closedir( dir );
- }
This won't work, closedir() is going to close the file descriptor.
Would it be acceptable to duplicate the fd before the check?
That's what you'd have to do, yes. But honestly I'm not sure that this check is a good idea in the first place. I wonder if we shouldn't remove the directory right away instead.