myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_1-2-g0


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_1-2-g0c7833c
Date: Sun, 13 Dec 2009 02:37:59 +0000

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 "GNU MyServer".

The branch, master has been updated
       via  0c7833c06f20f0172cc1e3bf7d116db84cdf0127 (commit)
      from  c615d09d073168cce8f00997e8681ae8b41c9e37 (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 -----------------------------------------------------------------


commit 0c7833c06f20f0172cc1e3bf7d116db84cdf0127
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Dec 13 03:37:30 2009 +0100

    Use the `gethostname' gnulib module.
    
    It ensures that HOST_NAME_MAX is always defined.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 8df4683..243a303 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -27,6 +27,7 @@ chdir-long
 crypto/md5
 crypto/sha1
 getcwd
+gethostname
 gettext
 gettimeofday
 nproc
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 943b0b3..1d3ccd9 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -261,7 +261,7 @@ int Server::postLoad ()
   string buffer;
 
   /* Get the name of the local machine.  */
-  memset (serverName, 0, HOST_NAME_MAX+1);
+  memset (serverName, 0, HOST_NAME_MAX + 1);
   Socket::gethostname (serverName, HOST_NAME_MAX);
 
   log (MYSERVER_LOG_MSG_INFO, _("Host name: %s"), serverName);
diff --git a/myserver/tests/test_socket.cpp b/myserver/tests/test_socket.cpp
index 9a685bd..024cce0 100644
--- a/myserver/tests/test_socket.cpp
+++ b/myserver/tests/test_socket.cpp
@@ -68,15 +68,8 @@ public:
 
   void testGethostname ( )
   {
-    int len;
-#ifdef HOST_NAME_MAX
-    len = HOST_NAME_MAX;
+    int len = HOST_NAME_MAX;
     char host[HOST_NAME_MAX];
-#else
-    len = 255;
-    char host[255];
-#endif
-
     int status = obj->gethostname ( host, len );
 
     CPPUNIT_ASSERT_EQUAL ( status, 0 );
@@ -103,15 +96,14 @@ public:
                                       (const char*) &optvalReuseAddr,
                                       sizeof (optvalReuseAddr) ) != -1 );
 
-    // If the port is used by another program, try a few others.
-      if ( ( status = obj->bind ( &sockIn, sockInLen ) ) != 0 )
+    /* If the port is used by another program, try a few others.  */
+    if ( ( status = obj->bind ( &sockIn, sockInLen ) ) != 0 )
       while ( ++port < 28000 )
-      {
-        ((sockaddr_in*) (&sockIn))->sin_port = htons ( port );
-
-        if ( ( status = obj->bind ( &sockIn, sockInLen ) ) == 0 )
-          break;
-      }
+        {
+          ((sockaddr_in*) (&sockIn))->sin_port = htons ( port );
+          if ( ( status = obj->bind ( &sockIn, sockInLen ) ) == 0 )
+            break;
+        }
 
     CPPUNIT_ASSERT ( status != -1 );
 

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

Summary of changes:
 myserver/bootstrap.conf        |    1 +
 myserver/src/server/server.cpp |    2 +-
 myserver/tests/test_socket.cpp |   24 ++++++++----------------
 3 files changed, 10 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]