On Sun, May 01, 2016 at 06:14:16PM +0700, Nguyễn Thái Ngọc Duy wrote: > This is a spinoff from my worktree-move topic. This series adds > die_errno() companions, error_errno() and warning_errno(), and use them > where applicable to reduce the amount of typing (in future). I had this patch in the series but excluded it before sending because there is something wrong about it. The patch shows two code blocks that follow the same pattern: closesocket() then print an error with strerror(). The second block suggests that closesocket() can change errno. But if that's true, the first block should do the same. Which is right? Fix the first block to save errno, or drop the saving in the second block? diff --git a/compat/mingw.c b/compat/mingw.c index 0413d5c..b6de02c 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1555,8 +1555,7 @@ int mingw_socket(int domain, int type, int protocol) /* convert into a file descriptor */ if ((sockfd = _open_osfhandle(s, O_RDWR|O_BINARY)) < 0) { closesocket(s); - return error("unable to make a socket file descriptor: %s", - strerror(errno)); + return error_errno("unable to make a socket file descriptor"); } return sockfd; } @@ -1606,10 +1605,8 @@ int mingw_accept(int sockfd1, struct sockaddr *sa, socklen_t *sz) /* convert into a file descriptor */ if ((sockfd2 = _open_osfhandle(s2, O_RDWR|O_BINARY)) < 0) { - int err = errno; closesocket(s2); - return error("unable to make a socket file descriptor: %s", - strerror(err)); + return error_errno("unable to make a socket file descriptor"); } return sockfd2; } -- 2.8.0.rc0.210.gd302cd2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html