[libvirt] [PATCH 09/17] use errno, not socket_errno()

Jim Meyering jim at meyering.net
Tue Oct 28 11:21:26 UTC 2008


From: Jim Meyering <meyering at redhat.com>

* remote_internal.c: s/socket_errno()/errno/, now that gnulib's
socket module ensures errno is useful in those cases.
---
 src/remote_internal.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/remote_internal.c b/src/remote_internal.c
index 787cfaa..5f528a8 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -482,7 +482,7 @@ doRemoteOpen (virConnectPtr conn,

             priv->sock = socket (r->ai_family, SOCK_STREAM, 0);
             if (priv->sock == -1) {
-                saved_errno = socket_errno();
+                saved_errno = errno;
                 continue;
             }

@@ -492,7 +492,7 @@ doRemoteOpen (virConnectPtr conn,
                         sizeof no_slow_start);

             if (connect (priv->sock, r->ai_addr, r->ai_addrlen) == -1) {
-                saved_errno = socket_errno();
+                saved_errno = errno;
                 close (priv->sock);
                 continue;
             }
@@ -3980,7 +3980,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
                          _("failed to get sock address %d (%s)"),
-                         socket_errno (), strerror(socket_errno ()));
+                         errno, strerror(errno));
         goto cleanup;
     }
     if ((localAddr = addrToString(&sa, salen)) == NULL)
@@ -3992,7 +3992,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
         __virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
                          VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
                          _("failed to get peer address %d (%s)"),
-                         socket_errno (), strerror(socket_errno ()));
+                         errno, strerror(errno));
         goto cleanup;
     }
     if ((remoteAddr = addrToString(&sa, salen)) == NULL)
@@ -4627,7 +4627,7 @@ really_write_buf (virConnectPtr conn, struct private_data *priv,
         do {
             err = send (priv->sock, p, len, 0);
             if (err == -1) {
-                int errno_ = socket_errno ();
+                int errno_ = errno;
                 if (errno_ == EINTR || errno_ == EAGAIN)
                     continue;
                 error (in_open ? NULL : conn,
@@ -4710,7 +4710,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
     reread:
         err = recv (priv->sock, bytes, len, 0);
         if (err == -1) {
-            int errno_ = socket_errno ();
+            int errno_ = errno;
             if (errno_ == EINTR)
                 goto reread;
             error (in_open ? NULL : conn,
-- 
1.6.0.3.756.gb776d




More information about the libvir-list mailing list