From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCW1U-0006Rp-9Z for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:01:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCW1S-0002rV-FO for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:01:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCW1S-0002r3-7F for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:01:14 -0400 Message-ID: <4F71BA07.9040007@redhat.com> Date: Tue, 27 Mar 2012 15:00:55 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <20120322035052.2431.4994.stgit@dhcp-8-167.nay.redhat.com> <20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com> In-Reply-To: <20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, laine@redhat.com On 03/22/2012 05:52 AM, Amos Kong wrote: > Introduce set_socket_error() to set the errno, use > WSASetLastError() for win32. > Sometimes, clean work would rewrite errno in error path, > we can use this function to restore real errno. > > Signed-off-by: Amos Kong > --- > qemu_socket.h | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/qemu_socket.h b/qemu_socket.h > index fe4cf6c..a4c5170 100644 > --- a/qemu_socket.h > +++ b/qemu_socket.h > @@ -8,6 +8,7 @@ > #include > > #define socket_error() WSAGetLastError() > +#define set_socket_error(e) WSASetLastError(e) > #undef EINTR > #define EWOULDBLOCK WSAEWOULDBLOCK > #define EINTR WSAEINTR > @@ -26,6 +27,7 @@ int inet_aton(const char *cp, struct in_addr *ia); > #include > > #define socket_error() errno > +#define set_socket_error(e) errno = e how about creating a function set_errno(int e) and use it in the macro. Orit > #define closesocket(s) close(s) > > #endif /* !_WIN32 */ > >