Commit a467a28a authored by Timothy Stack's avatar Timothy Stack
Browse files

Ensure that the experiment logs directory exists.

parent 863602d5
......@@ -22,6 +22,7 @@
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <time.h>
......@@ -865,8 +866,16 @@ dequeue(event_handle_t handle)
int
SetExpPath(const char *path)
{
struct stat st;
int retval;
setenv("EXPDIR", path, 1);
return chdir(path);
retval = chdir(path);
if (stat("logs", &st) == -1)
mkdir("logs", 0770);
return retval;
}
int
......
......@@ -162,6 +162,14 @@ my (undef,undef,$unix_pgid) = getgrnam($pid) or
die("*** $0:\n".
" No such group $pid\n");
my $LOGDIR = `dirname $logfile`;
if (! -d $LOGDIR) {
if (system("mkdir -p -m 775 $LOGDIR")) {
die("*** $0:\n".
" Could not mkdir $LOGDIR\n");
}
}
#
# Create a chile whose output is directed into the logfile. Parents waits
# a moment and then exits.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment