Thread (5 messages) flat view 5 messages, 2 authors, 2021-06-11

Re: [PATCH iproute2] utils: bump max args number to 256 for batch files

From: Guillaume Nault <hidden>
Date: 2021-06-11 09:51:38

On Thu, Jun 10, 2021 at 04:17:42PM -0700, Stephen Hemminger wrote:
On Thu, 10 Jun 2021 09:58:57 +0200
Guillaume Nault [off-list ref] wrote:
quoted
quoted
diff --git a/include/utils.h b/include/utils.h
index 187444d52b41..6c4c403fe6c2 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -50,6 +50,9 @@ void incomplete_command(void) __attribute__((noreturn));
 #define NEXT_ARG_FWD() do { argv++; argc--; } while(0)
 #define PREV_ARG() do { argv--; argc++; } while(0)
 
+/* upper limit for batch mode */
+#define MAX_ARGS 512
+
 #define TIME_UNITS_PER_SEC     1000000
 #define NSEC_PER_USEC 1000
 #define NSEC_PER_MSEC 1000000
diff --git a/lib/utils.c b/lib/utils.c
index 93ae0c55063a..0559923beced 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1714,10 +1714,10 @@ int do_batch(const char *name, bool force,
 
        cmdlineno = 0;
        while (getcmdline(&line, &len, stdin) != -1) {
-               char *largv[100];
+               char *largv[MAX_ARGS];
                int largc;
 
-               largc = makeargs(line, largv, 100);
+               largc = makeargs(line, largv, MAX_ARGS);
                if (!largc)
                        continue;       /* blank line */
 
  
Is this a patch you're going to apply, or should I repost it formally?
Either way, you get credit
I've sent v2. Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help