Cygwin: Change /proc/$PID/fd/<fd> symlink target for deleted files
- As on Linux, print the file name with an attached " (deleted)" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
4cd209e921
commit
7148fbc496
|
@ -137,11 +137,23 @@ fhandler_base::set_name (path_conv &in_pc)
|
||||||
|
|
||||||
char *fhandler_base::get_proc_fd_name (char *buf)
|
char *fhandler_base::get_proc_fd_name (char *buf)
|
||||||
{
|
{
|
||||||
|
IO_STATUS_BLOCK io;
|
||||||
|
FILE_STANDARD_INFORMATION fsi;
|
||||||
|
|
||||||
/* If the file had been opened with O_TMPFILE | O_EXCL, don't
|
/* If the file had been opened with O_TMPFILE | O_EXCL, don't
|
||||||
expose the filename. linkat is supposed to return ENOENT in this
|
expose the filename. linkat is supposed to return ENOENT in this
|
||||||
case. See man 2 open on Linux. */
|
case. FIXME: As soon as we open by handle from /proc/<PID>/fd,
|
||||||
if ((get_flags () & (O_TMPFILE | O_EXCL)) == (O_TMPFILE | O_EXCL))
|
the O_EXCL test has to be moved to open. */
|
||||||
return strcpy (buf, "");
|
if ((get_flags () & (O_TMPFILE | O_EXCL)) == (O_TMPFILE | O_EXCL)
|
||||||
|
|| (get_device () == FH_FS
|
||||||
|
&& NT_SUCCESS (NtQueryInformationFile (get_handle (), &io,
|
||||||
|
&fsi, sizeof fsi,
|
||||||
|
FileStandardInformation))
|
||||||
|
&& fsi.DeletePending))
|
||||||
|
{
|
||||||
|
stpcpy (stpcpy (buf, get_name ()), " (deleted)");
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
if (get_name ())
|
if (get_name ())
|
||||||
return strcpy (buf, get_name ());
|
return strcpy (buf, get_name ());
|
||||||
if (dev ().name ())
|
if (dev ().name ())
|
||||||
|
|
Loading…
Reference in New Issue