Created
September 12, 2011 23:34
-
-
Save isaacs/1212769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 3c00d87b4239a6b8358e2085f806170c3eca10cf Mon Sep 17 00:00:00 2001 | |
From: isaacs <i@izs.me> | |
Date: Mon, 12 Sep 2011 16:31:18 -0700 | |
Subject: [PATCH] Add EEXIST handling | |
Additionally, map ERROR_ALREADY_EXISTS to EEXIST on Windows. I'm a bit | |
unsure about this mapping. Could a windows person confirm? | |
--- | |
include/uv.h | 3 ++- | |
src/unix/error.c | 1 + | |
src/uv-common.c | 1 + | |
src/win/error.c | 1 + | |
4 files changed, 5 insertions(+), 1 deletions(-) | |
diff --git a/include/uv.h b/include/uv.h | |
index 13b40d8..bf7e88a 100644 | |
--- a/include/uv.h | |
+++ b/include/uv.h | |
@@ -183,7 +183,8 @@ typedef enum { | |
UV_EAINONAME, | |
UV_EAISERVICE, | |
UV_EAISOCKTYPE, | |
- UV_ESHUTDOWN | |
+ UV_ESHUTDOWN, | |
+ UV_EEXIST | |
} uv_err_code; | |
typedef enum { | |
diff --git a/src/unix/error.c b/src/unix/error.c | |
index 96615f3..3520eec 100644 | |
--- a/src/unix/error.c | |
+++ b/src/unix/error.c | |
@@ -83,6 +83,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) { | |
case EADDRINUSE: return UV_EADDRINUSE; | |
case EADDRNOTAVAIL: return UV_EADDRNOTAVAIL; | |
case ENOTCONN: return UV_ENOTCONN; | |
+ case EEXIST: return UV_EEXIST; | |
default: return UV_UNKNOWN; | |
} | |
diff --git a/src/uv-common.c b/src/uv-common.c | |
index ec31688..5118833 100644 | |
--- a/src/uv-common.c | |
+++ b/src/uv-common.c | |
@@ -87,6 +87,7 @@ const char* uv_err_name(uv_err_t err) { | |
case UV_EPROTONOSUPPORT: return "EPROTONOSUPPORT"; | |
case UV_EPROTOTYPE: return "EPROTOTYPE"; | |
case UV_ETIMEDOUT: return "ETIMEDOUT"; | |
+ case UV_EEXIST: return "EEXIST"; | |
default: | |
assert(0); | |
return NULL; | |
diff --git a/src/win/error.c b/src/win/error.c | |
index ed4e0d5..8de90be 100644 | |
--- a/src/win/error.c | |
+++ b/src/win/error.c | |
@@ -130,6 +130,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) { | |
case ERROR_BROKEN_PIPE: return UV_EOF; | |
case ERROR_PIPE_BUSY: return UV_EBUSY; | |
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT; | |
+ case ERROR_ALREADY_EXISTS: return UV_EEXIST; | |
default: return UV_UNKNOWN; | |
} | |
} | |
-- | |
1.7.2.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment