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_2-90-g


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-90-g6797784
Date: Sat, 27 Mar 2010 21:37:35 +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  679778479c11f73540bcec24a0ff508d33aad3ea (commit)
       via  487b1ebd6389e76bfac4d725878dc8b163afb4ff (commit)
       via  465da19dc33cd5664a3371d4fce1b95adfd133c0 (commit)
      from  99dad7ad83b119a689d237639e8ea01c13a089a6 (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 679778479c11f73540bcec24a0ff508d33aad3ea
Author: Daniele Cocca <address@hidden>
Date:   Sat Mar 27 20:26:34 2010 +0100

    Refactor the code that checks if the server is called with an absolute path.
    
    The `updateWorkingDirectory' method was extracted from `main'.

diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index dc487c3..ea51af4 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -348,6 +348,24 @@ int loadConfFilesLocation (string &mainConfigurationFile,
   return 0;
 }
 
+static void updateWorkingDirectory (const char *firstArgument)
+{
+  string path (firstArgument);
+  size_t index;
+
+#ifdef WIN32
+  index = path.find_last_of ('\\');
+#else
+  index = path.find_last_of ('/');
+#endif
+
+  if (index != string::npos)
+    {
+      string newdir (path, 0, index);
+      setcwd (newdir.c_str ());
+    }
+}
+
 static MainConfiguration *_genMainConf (Server *server, const char *arg)
 {
   XmlMainConfiguration *conf = new XmlMainConfiguration ();
@@ -397,38 +415,8 @@ int main (int argn, char **argv)
       return 1;
     };
 
-  u_int pathLen = 0;
-  u_int len = 0;
-  bool differentCwd = false;
-  char *path;
-
-  pathLen = strlen (argv[0]);
-  path = new char[pathLen + 1];
-  if (path == 0)
-    return 1;
-  strncpy (path, argv[0], pathLen);
-
-  for (len = 0; len < pathLen; len++)
-    {
-      if (path[len] == '/' || path[len] == '\\')
-        {
-          differentCwd = true;
-          break;
-        }
-    }
-
-  if (differentCwd)
-    {
-      len = pathLen;
-      while ((path[len] != '\\') && (path[len] != '/'))
-        len--;
-      path[len] = '\0';
-
-      setcwd (path);
-    }
-
-  /* We can free path memory now.  */
-  delete [] path;
+  /* Move to a different working directory, if necessary.  */
+  updateWorkingDirectory (argv[0]);
 
   /* Call the parser.  */
   argp_parse (&myserverArgp, argn, argv, 0, 0, &input);



commit 487b1ebd6389e76bfac4d725878dc8b163afb4ff
Author: Giuseppe Scrivano <address@hidden>
Date:   Sat Mar 27 18:15:22 2010 +0100

    Fix autoconf warning.

diff --git a/myserver/configure.ac b/myserver/configure.ac
index cd6834a..a0df4b7 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -32,6 +32,8 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 AC_CONFIG_MACRO_DIR([m4])
 
+AC_USE_SYSTEM_EXTENSIONS
+
 AC_PROG_INSTALL
 AC_PROG_CC
 AC_PROG_CXX
@@ -41,7 +43,6 @@ gl_EARLY
 
 AC_ENABLE_SHARED
 
-AC_USE_SYSTEM_EXTENSIONS
 AC_SEARCH_LIBS([strerror],[cposix])
 AC_USE_SYSTEM_EXTENSIONS
 AC_HEADER_STDC



commit 465da19dc33cd5664a3371d4fce1b95adfd133c0
Author: Giuseppe Scrivano <address@hidden>
Date:   Sat Mar 27 18:13:06 2010 +0100

    Remove `read' from the list of imported gnulib modules.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 369f5c9..03f3b98 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -45,7 +45,6 @@ mktime
 nproc
 open
 pipe
-read
 read-file
 readlink
 recv

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

Summary of changes:
 myserver/bootstrap.conf   |    1 -
 myserver/configure.ac     |    3 +-
 myserver/src/myserver.cpp |   52 +++++++++++++++++---------------------------
 3 files changed, 22 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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