[Saga-devel] saga SVN commit 3401: /trunk/adaptors/default/job/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Thu Jan 29 10:57:52 CST 2009


User: amerzky
Date: 2009/01/29 10:57 AM

Modified:
 /trunk/adaptors/default/job/
  impl_posix_job.cpp

Log:
 simplify and fix.  This should make buildbot happy.
 A

File Changes:

Directory: /trunk/adaptors/default/job/
=======================================

File [modified]: impl_posix_job.cpp
Delta lines: +3 -23
===================================================================
--- trunk/adaptors/default/job/impl_posix_job.cpp	2009-01-29 12:53:50 UTC (rev 3400)
+++ trunk/adaptors/default/job/impl_posix_job.cpp	2009-01-29 16:57:43 UTC (rev 3401)
@@ -180,7 +180,6 @@
       // we need these for execve
       std::string exe;
       char** cargs = NULL;
-      char** cenv  = NULL;
 
       // if the child dies before it can release the semaphores,
       // the main thread will hang.  Thus we need to do
@@ -300,31 +299,12 @@
           env = jd_.get_vector_attribute (saga::job::attributes::description_environment);
         }
 
-        cenv = (char**) ::calloc (env.size () + 1, sizeof (char*));
-
-        if ( NULL == cenv )
-        {
-          log ("calloc failed", strerror (errno));
-          SAGA_ADAPTOR_THROW_NO_CONTEXT (std::string ("calloc failed: ") + strerror (errno),
-                                         saga::NoSuccess);
-        }
-          
         for ( unsigned int j = 0; j < env.size (); j++ )
         {
-          cenv[j] = ::strdup (env[j].c_str ());
-
-          log ("setenv", env[j]);
-
-          if ( NULL == cenv[j] )
-          {
-            log ("strdup failed", strerror (errno));
-            SAGA_ADAPTOR_THROW_NO_CONTEXT (std::string ("strdup failed: ") + strerror (errno),
-                                           saga::NoSuccess);
-          }
+          char* charptr = ::strdup (env[j].c_str ());
+          ::putenv (env[j].c_str ());
         }
 
-        cenv[env.size () + 1] = NULL;
-
         log (" == running ", cmd);
 
         // FIXME: we actually need a sync point with the parent
@@ -360,7 +340,7 @@
       }
 
       // finally, run the child program
-      ::execve (exe.c_str (), cargs, cenv);
+      ::execv (exe.c_str (), cargs);
 
       // Nonono - thats wrong!
       log ("execv failed", strerror (errno));



More information about the saga-devel mailing list