* dir.cc (opendir): Fix indentation.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Move storing fhandler in file descriptor table to some point very late in function to avoid double free'ing. Add comment to explain what happens. Add label free_mounts and don't forget to delete __DIR_mounts structure if NtOpenFile fails.
This commit is contained in:
parent
961fe49069
commit
ecdee6e98a
|
@ -1,3 +1,12 @@
|
|||
2006-03-03 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dir.cc (opendir): Fix indentation.
|
||||
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Move storing
|
||||
fhandler in file descriptor table to some point very late in function
|
||||
to avoid double free'ing. Add comment to explain what happens.
|
||||
Add label free_mounts and don't forget to delete __DIR_mounts structure
|
||||
if NtOpenFile fails.
|
||||
|
||||
2006-03-02 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* syscalls.cc (chroot): Disallow chroot into special directories.
|
||||
|
|
|
@ -1542,10 +1542,6 @@ fhandler_disk_file::opendir ()
|
|||
if (fd < 0)
|
||||
goto free_dirent;
|
||||
|
||||
fd = this;
|
||||
fd->nohandle (true);
|
||||
dir->__d_fd = fd;
|
||||
dir->__fh = this;
|
||||
/* FindFirstFile doesn't seem to like duplicate /'s.
|
||||
The dirname is generated with trailing backslash here which
|
||||
simplifies later usage of dirname for checking symlinks.
|
||||
|
@ -1583,7 +1579,7 @@ fhandler_disk_file::opendir ()
|
|||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
goto free_dirent;
|
||||
goto free_mounts;
|
||||
}
|
||||
|
||||
/* FileIdBothDirectoryInformation is apparently unsupported on XP
|
||||
|
@ -1602,12 +1598,22 @@ fhandler_disk_file::opendir ()
|
|||
}
|
||||
}
|
||||
}
|
||||
/* Filling fd with `this' (aka storing this in the file descriptor table
|
||||
should only happen after it's clear that opendir doesn't fail,
|
||||
otherwise we end up cfree'ing the fhandler twice, once in opendir()
|
||||
in dir.cc, the second time on exit. Nasty, nasty... */
|
||||
fd = this;
|
||||
fd->nohandle (true);
|
||||
dir->__d_fd = fd;
|
||||
dir->__fh = this;
|
||||
res = dir;
|
||||
}
|
||||
|
||||
syscall_printf ("%p = opendir (%s)", res, get_name ());
|
||||
return res;
|
||||
|
||||
free_mounts:
|
||||
delete d_mounts (dir);
|
||||
free_dirent:
|
||||
free (dir->__d_dirent);
|
||||
free_dirname:
|
||||
|
|
Loading…
Reference in New Issue