errormap: Add unix_to_werror() function
authorKai Blin <kai@samba.org>
Wed, 26 Jan 2011 21:17:43 +0000 (22:17 +0100)
committerKai Blin <kai@samba.org>
Wed, 26 Jan 2011 22:07:24 +0000 (23:07 +0100)
While this function technically is closest to the
map_nt_status_from_unix() function, I think it is better to keep the new
function in line with our usual fooerror_to_barerror() naming scheme.

Signed-off-by: Kai Blin <kai@samba.org>
Autobuild-User: Kai Blin <kai@samba.org>
Autobuild-Date: Wed Jan 26 23:07:24 CET 2011 on sn-devel-104

libcli/util/error.h
source3/lib/errmap_unix.c
source4/libcli/util/errormap.c

index 5a7cc1b0b99efee12122bbde1da89242069276fd..77a2f5a43347115200f40f4cc21c6f62a6289a33 100644 (file)
@@ -46,4 +46,9 @@ WERROR ntstatus_to_werror(NTSTATUS error);
 *********************************************************************/
 NTSTATUS map_nt_error_from_unix(int unix_error);
 
+/*********************************************************************
+convert a Unix error code to a WERROR
+*********************************************************************/
+WERROR unix_to_werror(int unix_error);
+
 #endif /* _SAMBA_ERROR_H */
index 91a620eccec2ccb2de1b642e21ea68bf1f33d854..b4a98f963423a21a53581626ce7bc2754b507643 100644 (file)
@@ -141,6 +141,12 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
        return NT_STATUS_ACCESS_DENIED;
 }
 
+/* Convert a Unix error code to a WERROR. */
+WERROR unix_to_werror(int unix_error)
+{
+       return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
+}
+
 /* Return a UNIX errno from a NT status code */
 static const struct {
        NTSTATUS status;
index 8fcf60b44e8c9bd3541c4d02fd5bb3e823fd2063..29f2331cdee4c4e9ef14a1537337649c47a7c1bd 100644 (file)
@@ -1383,6 +1383,12 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
        return NT_STATUS_UNSUCCESSFUL;
 }
 
+/* Convert a Unix error code to WERROR */
+WERROR unix_to_werror(int unix_error)
+{
+       return ntstatus_to_werror(map_nt_error_from_unix(unix_error));
+}
+
 NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
 {
        switch (ndr_err) {