summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcli/util/error.h5
-rw-r--r--source3/lib/errmap_unix.c6
-rw-r--r--source4/libcli/util/errormap.c6
3 files changed, 17 insertions, 0 deletions
diff --git a/libcli/util/error.h b/libcli/util/error.h
index 5a7cc1b0b9..77a2f5a433 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -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 */
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 91a620ecce..b4a98f9634 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -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;
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 8fcf60b44e..29f2331cde 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -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) {