[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. debian/0.8-1-15-g1e42ea5

Enrico Zini enrico at enricozini.org
Sat Jul 9 08:39:27 UTC 2011


The following commit has been merged in the master branch:
commit bdff56b03fe9db2fc043a3a60dc7a890591df0f8
Author: Enrico Zini <enrico at enricozini.org>
Date:   Sat Jul 9 09:15:10 2011 +0100

    Add -nolisten tcp to X options if missing

diff --git a/dm.c b/dm.c
index 4bd1470..59d43d0 100644
--- a/dm.c
+++ b/dm.c
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <time.h>
+#include <string.h>
 
 
 void nodm_display_manager_init(struct nodm_display_manager* dm)
@@ -253,7 +254,8 @@ int nodm_display_manager_parse_xcmdline(struct nodm_display_manager* s, const ch
     unsigned argc = 0;
     // +1 for the X server pathname, +1 for the display name,
     // +1 for the VT number, +1 for the trailing NULL
-    argv =(char**)malloc((toks->we_wordc + 4) * sizeof(char*));
+    // +2 for '-nolisten tcp'
+    argv =(char**)malloc((toks->we_wordc + 6) * sizeof(char*));
     if (argv == NULL)
     {
         return_code = E_OS_ERROR;
@@ -282,6 +284,9 @@ int nodm_display_manager_parse_xcmdline(struct nodm_display_manager* s, const ch
         ++argc;
     }
 
+    int nolisten_idx = -2;
+    bool has_nolisten_tcp = false;
+
     // Copy other args
     while (in_arg < toks->we_wordc)
     {
@@ -289,8 +294,20 @@ int nodm_display_manager_parse_xcmdline(struct nodm_display_manager* s, const ch
         if (sscanf(toks->we_wordv[in_arg], "vt%d", &vtn) == 1)
             // if vtN has been provided by the caller, disable VT allocation
             s->vt.conf_initial_vt = -1;
+        else if (strcmp(toks->we_wordv[in_arg], "-nolisten") == 0)
+            nolisten_idx = in_arg;
+        else if (strcmp(toks->we_wordv[in_arg], "tcp") == 0 && nolisten_idx == in_arg - 1)
+            has_nolisten_tcp = true;
+
+
         argv[argc++] = toks->we_wordv[in_arg++];
     }
+    // Append -nolisten tcp if it wasn't in the command line
+    if (!has_nolisten_tcp)
+    {
+        argv[argc++] = "-nolisten";
+        argv[argc++] = "tcp";
+    }
     argv[argc] = NULL;
 
     s->srv.argv = (const char**)argv;

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list