summaryrefslogtreecommitdiff
path: root/libcli/util
diff options
context:
space:
mode:
Diffstat (limited to 'libcli/util')
-rw-r--r--libcli/util/error.h5
-rw-r--r--libcli/util/errormap.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/libcli/util/error.h b/libcli/util/error.h
index 5c4dc10916..0972601afb 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -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 */
diff --git a/libcli/util/errormap.c b/libcli/util/errormap.c
index f96d83fa62..714e62c0d7 100644
--- a/libcli/util/errormap.c
+++ b/libcli/util/errormap.c
@@ -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));
+}