diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-04-16 19:42:29 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-04-16 19:42:29 +0400 |
commit | 7cdcd90ca146cd1322051385d92114b9b927776b (patch) | |
tree | 14e07ae36b023f3f1140ecb02ad8a3b795ef3418 /winsup/cygwin/errno.cc | |
parent | 6b0f100a6dd94d995a5d66aec0a1c4822e069435 (diff) |
* cygerrno.h (seterrno_from_nt_status): Declare.
(__seterrno_from_nt_status): Call seterrno_from_nt_status.
* errno.cc (seterrno_from_win_error): Set errno without calling
set_errno to avoid packing strace output with errno messages.
(seterrno_from_nt_status): New function to print NT status as well as
resulting Windows error.
Diffstat (limited to 'winsup/cygwin/errno.cc')
-rw-r--r-- | winsup/cygwin/errno.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index 617970a72..736510169 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -1,7 +1,7 @@ /* errno.cc: errno-related functions Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2008, 2009 Red Hat, Inc. + 2006, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -14,6 +14,7 @@ details. */ #define _sys_errlist FOO_sys_errlist #include "winsup.h" #include "cygtls.h" +#include "ntdll.h" #undef _sys_nerr #undef sys_nerr #undef _sys_errlist @@ -316,7 +317,19 @@ void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) { syscall_printf ("%s:%d windows error %d", file, line, code); - set_errno (geterrno_from_win_error (code, EACCES)); + errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES); +} + +/* seterrno_from_nt_status: Given a NT status code, set errno + as appropriate. */ +void __stdcall +seterrno_from_nt_status (const char *file, int line, NTSTATUS status) +{ + DWORD code = RtlNtStatusToDosError (status); + SetLastError (code); + syscall_printf ("%s:%d status %p -> windows error %d", + file, line, status, code); + errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES); } /* seterrno: Set `errno' based on GetLastError (). */ |