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, 28 Sep 2011 00:02:35 +0000 (02:02 +0200)
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>
libcli/util/error.h
libcli/util/errormap.c

index 5c4dc10916bf4a0435b2687a902976f16e1ed5ba..0972601afb1e417ec3c43f36ac1a51ef3c144c14 100644 (file)
@@ -45,4 +45,9 @@ NTSTATUS map_nt_error_from_unix_common(int unix_error);
 
 NTSTATUS nt_status_squash(NTSTATUS nt_status);
 
+/*****************************************************************************
+convert a Unix error to a WERROR
+ *****************************************************************************/
+WERROR unix_to_werror(int unix_error);
+
 #endif /* _SAMBA_ERROR_H */
index f96d83fa62a95fdfed162902b13da22b3f77d74e..714e62c0d79ce2260c848811411620fde5cc8d23 100644 (file)
@@ -1238,3 +1238,8 @@ WERROR ntstatus_to_werror(NTSTATUS error)
        return W_ERROR(NT_STATUS_V(error) & 0xffff);
 }
 
+/* Convert a Unix error code to a WERROR. */
+WERROR unix_to_werror(int unix_error)
+{
+       return ntstatus_to_werror(map_nt_error_from_unix_common(unix_error));
+}