Skip to content
This repository
Browse code

review feedback fixes

  • Loading branch information...
commit 15c4253bb432ba197dacd1c00f4177ab10538225 1 parent 31f94db
authored November 02, 2011
2  src/unix/dl.c
@@ -26,8 +26,6 @@
26 26
 #include <errno.h>
27 27
 
28 28
 
29  
-static const uv_err_t uv_ok_ = { UV_OK, 0 };
30  
-
31 29
 uv_err_t uv_dlopen(const char* filename, uv_lib_t* library) {
32 30
   void* handle = dlopen(filename, RTLD_LAZY);
33 31
   if (handle == NULL) {
3  src/uv-common.c
@@ -48,6 +48,9 @@ uv_buf_t uv_buf_init(char* base, size_t len) {
48 48
 }
49 49
 
50 50
 
  51
+const uv_err_t uv_ok_ = { UV_OK, 0 };
  52
+
  53
+
51 54
 const char* uv_err_name(uv_err_t err) {
52 55
   switch (err.code) {
53 56
     case UV_UNKNOWN: return "UNKNOWN";
2  src/uv-common.h
@@ -48,6 +48,8 @@ void uv_add_ares_handle(uv_loop_t* loop, uv_ares_task_t* handle);
48 48
 
49 49
 int uv_ares_handles_empty(uv_loop_t* loop);
50 50
 
  51
+extern const uv_err_t uv_ok_;
  52
+
51 53
 uv_err_code uv_translate_sys_error(int sys_errno);
52 54
 void uv__set_error(uv_loop_t* loop, uv_err_code code, int sys_error);
53 55
 void uv__set_sys_error(uv_loop_t* loop, int sys_error);
3  src/win/error.c
@@ -30,9 +30,6 @@
30 30
 #include "internal.h"
31 31
 
32 32
 
33  
-const uv_err_t uv_ok_ = { UV_OK, ERROR_SUCCESS };
34  
-
35  
-
36 33
 /*
37 34
  * Display an error message and abort the event loop.
38 35
  */
5  src/win/internal.h
@@ -286,11 +286,6 @@ void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle);
286 286
 int uv_parent_pid();
287 287
 
288 288
 
289  
-/*
290  
- * Error handling
291  
- */
292  
-extern const uv_err_t uv_ok_;
293  
-
294 289
 void uv_fatal_error(const int errorno, const char* syscall);
295 290
 
296 291
 uv_err_code uv_translate_sys_error(int sys_errno);
16  src/win/process.c
@@ -1062,22 +1062,23 @@ static uv_err_t uv__kill(HANDLE process_handle, int signum) {
1062 1062
   if (signum == SIGTERM || signum == SIGKILL) {
1063 1063
     /* Kill the process. On Windows, killed processes normally return 1. */
1064 1064
     if (TerminateProcess(process_handle, 1)) {
1065  
-      return uv_ok_;
  1065
+      err = uv_ok_;
1066 1066
     } else {
1067  
-      return uv__new_sys_error(GetLastError());
  1067
+      err = uv__new_sys_error(GetLastError());
1068 1068
     }
1069 1069
   } else if (signum == 0) {
1070 1070
     /* Health check: is the process still alive? */
1071 1071
     if (GetExitCodeProcess(process_handle, &status) &&
1072 1072
         status == STILL_ACTIVE) {
1073  
-      return uv_ok_;
  1073
+      err =  uv_ok_;
1074 1074
     } else {
1075  
-      err.code = UV_EINVAL;
1076  
-      return err;
  1075
+      err = uv__new_sys_error(GetLastError());
1077 1076
     }
  1077
+  } else {
  1078
+    err.code = UV_ENOSYS;
1078 1079
   }
1079 1080
 
1080  
-  return uv_ok_;
  1081
+  return err;
1081 1082
 }
1082 1083
 
1083 1084
 
@@ -1108,8 +1109,7 @@ uv_err_t uv_kill(int pid, int signum) {
1108 1109
     PROCESS_QUERY_INFORMATION, FALSE, pid);
1109 1110
 
1110 1111
   if (process_handle == INVALID_HANDLE_VALUE) {
1111  
-    err.code = UV_EINVAL;
1112  
-    return err;
  1112
+    return uv__new_sys_error(GetLastError());
1113 1113
   }
1114 1114
 
1115 1115
   err = uv__kill(process_handle, signum);
2  test/test-spawn.c
@@ -72,7 +72,7 @@ static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
72 72
    * child process is still alive, not kill it.
73 73
    */
74 74
   err = uv_kill(process->pid, 0);
75  
-  ASSERT(err.code == UV_EINVAL);
  75
+  ASSERT(err.code != UV_OK);
76 76
 }
77 77
 
78 78
 

0 notes on commit 15c4253

Please sign in to comment.
Something went wrong with that request. Please try again.