File 0876-erts-Comments-in-arg_file-should-not-create-an-empty.patch of Package erlang

From 6ee71ca7743cbc0b79e1f52b37f3c780356d1868 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Fri, 25 Oct 2019 10:24:25 +0200
Subject: [PATCH 3/3] erts: Comments in -arg_file should not create an empty
 argument

---
 erts/etc/common/erlexec.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index 85bb9bd455..07a66993de 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -1716,6 +1716,13 @@ static char **build_args_from_string(char *string, int allow_comments)
 	    case '\0':
 		state = Start;
 		break;
+            case '#':
+                if (allow_comments) {
+                    ++p;
+                    state = BuildComment;
+                    break;
+                }
+                /* fall-through */
 	    default:
 		state = Build;
 		break;
@@ -1723,6 +1730,10 @@ static char **build_args_from_string(char *string, int allow_comments)
 	    break;
 	case Build:
 	    switch (*p) {
+	    case '#':
+                if (!allow_comments)
+                    goto build_default;
+                /* fall-through */
 	    case '\n':
 	    case '\f':
 	    case '\r':
@@ -1747,14 +1758,8 @@ static char **build_args_from_string(char *string, int allow_comments)
 		++p;
 		state = AcceptNext;
 		break;
-            case '#':
-                if (allow_comments) {
-                    ++p;
-                    state = BuildComment;
-                    break;
-                }
-                /* fall-through */
 	    default:
+            build_default:
 		ENSURE();
 		(*cur_s)[s_pos++] = *p++;
 		break;
@@ -1797,7 +1802,7 @@ static char **build_args_from_string(char *string, int allow_comments)
 	    break;
         case BuildComment:
             if (*p == '\n' || *p == '\0') {
-                state = Build;
+                state = Build0;
             } else {
                 p++;
             }
-- 
2.16.4

openSUSE Build Service is sponsored by