mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-02 12:30:24 +08:00
Cygwin: AF_UNIX: peek_pipe: change error handling
Return an NTSTATUS code instead of a ULONG. Add a new ULONG reference argument to replace the previous return value.
This commit is contained in:
parent
1533431754
commit
cd42f043f4
@ -1059,7 +1059,8 @@ class fhandler_socket_unix : public fhandler_socket
|
|||||||
int wait_pipe (PUNICODE_STRING pipe_name);
|
int wait_pipe (PUNICODE_STRING pipe_name);
|
||||||
int connect_pipe (PUNICODE_STRING pipe_name);
|
int connect_pipe (PUNICODE_STRING pipe_name);
|
||||||
int listen_pipe ();
|
int listen_pipe ();
|
||||||
ULONG peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize, HANDLE evt);
|
NTSTATUS peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize, HANDLE evt,
|
||||||
|
ULONG &ret_len);
|
||||||
int disconnect_pipe (HANDLE ph);
|
int disconnect_pipe (HANDLE ph);
|
||||||
/* The NULL pointer check is required for FS methods like fstat. When
|
/* The NULL pointer check is required for FS methods like fstat. When
|
||||||
called via stat or lstat, there's no shared memory, just a path in pc. */
|
called via stat or lstat, there's no shared memory, just a path in pc. */
|
||||||
|
@ -723,7 +723,9 @@ fhandler_socket_unix::grab_admin_pkg ()
|
|||||||
if (!(evt = create_event ()))
|
if (!(evt = create_event ()))
|
||||||
return 0;
|
return 0;
|
||||||
io_lock ();
|
io_lock ();
|
||||||
ULONG ret_len = peek_pipe (pbuf, MAX_PATH, evt);
|
ULONG ret_len;
|
||||||
|
status = peek_pipe (pbuf, MAX_PATH, evt, ret_len);
|
||||||
|
/* FIXME: Check status and handle error. */
|
||||||
if (pbuf->NumberOfMessages == 0 || ret_len < sizeof (af_unix_pkt_hdr_t))
|
if (pbuf->NumberOfMessages == 0 || ret_len < sizeof (af_unix_pkt_hdr_t))
|
||||||
{
|
{
|
||||||
io_unlock ();
|
io_unlock ();
|
||||||
@ -1138,9 +1140,9 @@ fhandler_socket_unix::listen_pipe ()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
NTSTATUS
|
||||||
fhandler_socket_unix::peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize,
|
fhandler_socket_unix::peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize,
|
||||||
HANDLE evt)
|
HANDLE evt, ULONG &ret_len)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
@ -1154,9 +1156,10 @@ fhandler_socket_unix::peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize,
|
|||||||
if (NT_SUCCESS (status))
|
if (NT_SUCCESS (status))
|
||||||
status = io.Status;
|
status = io.Status;
|
||||||
}
|
}
|
||||||
return NT_SUCCESS (status) ? (io.Information
|
ret_len = (NT_SUCCESS (status)
|
||||||
- offsetof (FILE_PIPE_PEEK_BUFFER, Data))
|
? (io.Information - offsetof (FILE_PIPE_PEEK_BUFFER, Data))
|
||||||
: 0;
|
: 0);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user