commit-inetutils
[Top][All Lists]
Advanced

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

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-26-g073f4f


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-26-g073f4fc
Date: Sat, 04 Feb 2012 22:51:16 +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 Inetutils ".

The branch, master has been updated
       via  073f4fc44c6e5b95993afd555668d886c5654010 (commit)
      from  83e7003cbeb8aeacc77274091c566bf659579f81 (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.savannah.gnu.org/cgit/inetutils.git/commit/?id=073f4fc44c6e5b95993afd555668d886c5654010


commit 073f4fc44c6e5b95993afd555668d886c5654010
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Feb 4 23:49:19 2012 +0100

    logger: Add standard option `-u'.

diff --git a/ChangeLog b/ChangeLog
index abbcbf1..b6c7dea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-02-04  Mats Erik Andersson <address@hidden>
 
+       * src/logger.c (unixsock): New variable.
+       (open_socket): Allow HOST and UNIXSOCK to determine
+       UNIX socket name.  Add test that HOST be non-NULL.
+       (argp_options): New option `-u/--unix'.
+       (parse_opt) <h>: Erase UNIXSOCK, i.e., clear `-u'.
+       <u>: New option. Set UNIXSOCK, erase HOST.
+
+2012-02-04  Mats Erik Andersson <address@hidden>
+
        * libinetutils/Makefile.am (INCLUDES): Add $(INCAUTH) to list.
        * src/Makefile.am (INCLUDES): Likewise.
 
diff --git a/src/logger.c b/src/logger.c
index 2bcbdda..2d3185f 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -52,7 +52,10 @@
 static char *tag = NULL;
 static int logflags = 0;
 static int pri = MAKE_PRI (LOG_USER, LOG_NOTICE);
+/* Only one of `host' and `unixsock' will be non-NULL
+ * once option parsing has been completed. */
 static char *host = PATH_LOG;
+static char *unixsock = NULL;
 static char *source;
 static char *pidstr;
 
@@ -131,9 +134,17 @@ open_socket (void)
   int ret;
 #endif
 
-  if (host[0] == '/')
+  /* A UNIX socket name can be specified in two ways.
+   * Zero length of `unixsock' is handled automatically.  */
+  if ((host != NULL && host[0] == '/') || unixsock != NULL)
     {
-      size_t len = strlen (host);
+      size_t len;
+
+      /* Copy `unixsock' to `host' if necessary.
+       * There is no need to differentiate them.  */
+      if (unixsock)
+       host = unixsock;
+      len = strlen (host);
       if (len >= sizeof sockaddr.sunix.sun_path)
        error (EXIT_FAILURE, 0, "UNIX socket name too long");
       strcpy (sockaddr.sunix.sun_path, host);
@@ -379,7 +390,9 @@ static struct argp_option argp_options[] = {
   {"ipv4", '4', NULL, 0, "use IPv4 for logging to host" },
   {"ipv6", '6', NULL, 0, "use IPv6 with a host target" },
   { "host", 'h', "HOST", 0,
-    "log to host instead of the default " PATH_LOG },
+    "log to HOST instead of to the default " PATH_LOG },
+  { "unix", 'u', "SOCK", 0,
+    "log to UNIX socket SOCK instead of " PATH_LOG },
   { "source", 'S', "IP", 0,
     "set source IP address" },
   { "id", 'i', "PID", OPTION_ARG_OPTIONAL,
@@ -417,6 +430,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
     case 'h':
       host = arg;
+      unixsock = NULL; /* Erase any previous `-u'.  */
+      break;
+
+    case 'u':
+      unixsock = arg;
+      host = NULL;     /* Erase previous `-h'.  */
       break;
 
     case 'S':

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

Summary of changes:
 ChangeLog    |    9 +++++++++
 src/logger.c |   25 ++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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