[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1b1-14-ge5246b9

mysql vizuser noreply at mpich.org
Thu Aug 15 09:50:25 CDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  e5246b9f3045648e0985a8324822a16c71dc9dbb (commit)
      from  51b9bcdf516df768c5acca1a39caa5f8060966b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/e5246b9f3045648e0985a8324822a16c71dc9dbb

commit e5246b9f3045648e0985a8324822a16c71dc9dbb
Author: Huiwei Lu <huiweilu at mcs.anl.gov>
Date:   Wed Aug 14 15:00:25 2013 -0500

    Fixes #1851 - sizeof() usage inconsistencies in sock.c
    
    sizeof() is used inconsistently in pm/hydra/utils/sock/sock.c. In some
    places this is size of type, in some - size of variable.
    
    Thanks to Yauheni Zelenko for reporting this error.
    
    Signed-off-by: Wesley Bland <wbland at mcs.anl.gov>

diff --git a/src/pm/hydra/utils/sock/sock.c b/src/pm/hydra/utils/sock/sock.c
index bc5af12..3a772c4 100644
--- a/src/pm/hydra/utils/sock/sock.c
+++ b/src/pm/hydra/utils/sock/sock.c
@@ -68,16 +68,16 @@ HYD_status HYDU_sock_listen(int *listen_fd, char *port_range, uint16_t * port)
      * being set is not a fatal error, so we ignore that
      * case. However, we do check for error cases, which means that
      * something bad has happened. */
-    if (setsockopt(*listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0)
+    if (setsockopt(*listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)) < 0)
         HYDU_ERR_SETANDJUMP(status, HYD_SOCK_ERROR, "cannot set SO_REUSEADDR\n");
 
     for (i = low_port; i <= high_port; i++) {
-        memset((void *) &sa, 0, sizeof(sa));
+        memset((void *) &sa, 0, sizeof(struct sockaddr_in));
         sa.sin_family = AF_INET;
         sa.sin_port = htons(i);
         sa.sin_addr.s_addr = INADDR_ANY;
 
-        if (bind(*listen_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
+        if (bind(*listen_fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_in)) < 0) {
             /* If the address is in use, we should try the next
              * port. Otherwise, it's an error. */
             if (errno != EADDRINUSE)
@@ -98,7 +98,7 @@ HYD_status HYDU_sock_listen(int *listen_fd, char *port_range, uint16_t * port)
     /* We asked for any port, so we need to find out which port we
      * actually got. */
     if (*port == 0) {
-        socklen_t sinlen = sizeof(sa);
+        socklen_t sinlen = sizeof(struct sockaddr_in);
 
         if (getsockname(*listen_fd, (struct sockaddr *) &sa, &sinlen) < 0)
             HYDU_ERR_SETANDJUMP(status, HYD_SOCK_ERROR, "getsockname error (%s)\n",
@@ -149,7 +149,7 @@ HYD_status HYDU_sock_connect(const char *host, uint16_t port, int *fd, int retri
      * layer can decide what to do with the return status. */
     retry_count = 0;
     do {
-        ret = connect(*fd, (struct sockaddr *) &sa, sizeof(sa));
+        ret = connect(*fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_in));
         if (ret < 0 && errno == ECONNREFUSED) {
             /* connection error; increase retry count and delay */
             retry_count++;

-----------------------------------------------------------------------

Summary of changes:
 src/pm/hydra/utils/sock/sock.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list