From 8bc688b6eec889e7153ad30f9077350001d793ce Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Wed, 19 Jul 2017 10:18:46 -0500
Subject: [PATCH] Reset optind to 1 before parsing options

Normally the system is already doing this for us. In the MPI simgrid
execution case, however, depending on the enabled optimizations for memory,
libc may not be privatized, to save the memory that would be needed for its
duplication, and to avoid the potential headaches brought by several libcs
running in the same process. The first process would then inrease optind,
and other processes would start with optind already increased.
---
 timing/timing.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/timing/timing.c b/timing/timing.c
index 67d197ae2..60486be7e 100644
--- a/timing/timing.c
+++ b/timing/timing.c
@@ -583,6 +583,7 @@ parse_arguments(int *_argc, char ***_argv, int *iparam, int *start, int *stop, i
     int argc = *_argc;
     char **argv = *_argv;
 
+    optind = 1;
     do {
 #if defined(CHAMELEON_HAVE_GETOPT_LONG)
         opt = -1;
-- 
GitLab