From 37a61c38ce50678469b54a2559c34d92f307e1ac Mon Sep 17 00:00:00 2001
From: tewk <tewk@unknown>
Date: Wed, 3 Jul 2002 23:09:06 +0000
Subject: [PATCH] added execle line to task_mgr.c to automatically setup the
 env changed unpack_strarray to null terminate the array of strings

---
 src/common/pack.c     | 3 ++-
 src/slurmd/task_mgr.c | 7 +++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/common/pack.c b/src/common/pack.c
index bd09dfbe53f..92c42ebaf2d 100644
--- a/src/common/pack.c
+++ b/src/common/pack.c
@@ -268,11 +268,12 @@ _unpackstrarray (char ***valp, uint16_t *size_valp, void **bufp, int *lenp)
 	*lenp -= sizeof(nl);
 
 	if (*size_valp > 0) {
-		*valp = xmalloc(sizeof ( char * ) * *size_valp ) ;
+		*valp = xmalloc(sizeof ( char * ) * ( *size_valp +1 ) ) ;
 		for ( i = 0 ; i < *size_valp ; i ++ )
 		{
 			unpackstr_xmalloc ( & (*valp)[i] , & uint16_tmp , bufp , lenp ) ;
 		}
+		(*valp)[i] = NULL ; /* NULL terminated array so that execle can detect end of array */
 	}
 	else
 		*valp = NULL;
diff --git a/src/slurmd/task_mgr.c b/src/slurmd/task_mgr.c
index 37c326e9526..9a190f5b873 100644
--- a/src/slurmd/task_mgr.c
+++ b/src/slurmd/task_mgr.c
@@ -316,12 +316,11 @@ void * task_exec_thread ( void * arg )
 			
 			/* set session id */
 
-			/* setup requested env */
-			//setup_task_env ( task_arg ) ;
-
 			/* run bash and cmdline */
 			chdir ( launch_msg->cwd ) ;
-			execl ( "/bin/bash" , "bash" , "-c" , launch_msg->cmd_line );
+			execl ( "/bin/sh", launch_msg->cmd_line );
+
+			//execle ( "/bin/sh", launch_msg->cmd_line , launch_msg->env );
 			_exit ( SLURM_SUCCESS ) ;
 			
 		default: /*parent proccess */
-- 
GitLab