Cygwin: fix /proc/PID/fd return value in error case

commit 2607639992 "Improve error handling in /proc/[pid]/
virtual files." changed the return value of the /proc/PID
formatting functions to return -1 instead of 0 in the error
case to allow a filesize of 0.

The patch neglected to change this behaviour for /proc/PID/fd
content.  This patch fixes that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-07-22 18:36:38 +02:00 committed by Ken Brown
parent aeb38a24af
commit 30b08fcbdb
1 changed files with 2 additions and 2 deletions

View File

@ -389,13 +389,13 @@ format_process_fd (void *data, char *&destbuf)
if (fd < 0 || e == fdp || (*e != '/' && *e != '\0'))
{
set_errno (ENOENT);
return 0;
return -1;
}
destbuf = p ? p->fd (fd, fs) : NULL;
if (!destbuf || !*destbuf)
{
set_errno (ENOENT);
return 0;
return -1;
}
if (*e == '\0')
*((process_fd_t *) data)->fd_type = virt_fdsymlink;