[Darshan-commits] [Git][darshan/darshan][master] 2 commits: don't exit mk-log-dirs if dir already exists
Shane Snyder
xgitlab at cels.anl.gov
Fri Feb 5 12:29:17 CST 2021
Shane Snyder pushed to branch master at darshan / darshan
Commits:
54062646 by Shane Snyder at 2021-02-05T12:25:45-06:00
don't exit mk-log-dirs if dir already exists
Fixes #296
- - - - -
5155d0c7 by Shane Snyder at 2021-02-05T12:29:15-06:00
Merge branch 'fix-296-mk-log-dirs-exists' into 'master'
don't exit darshan-mk-log-dirs if log directory already exists
Closes #296
See merge request darshan/darshan!74
- - - - -
1 changed file:
- darshan-runtime/darshan-mk-log-dirs.pl.in
Changes:
=====================================
darshan-runtime/darshan-mk-log-dirs.pl.in
=====================================
@@ -22,24 +22,28 @@ my $k;
umask(0);
+if(not -d "$LOGDIR")
+{
+ print STDERR "Error: please make sure that the $LOGDIR directory already exists.\n";
+ exit(1)
+}
+
+if(not -w "$LOGDIR")
+{
+ print STDERR "Error: please make sure that the $LOGDIR directory is writeable.\n";
+ exit(1)
+}
+
# go through the end of next year
for ($i=$year; $i<($year+2); $i++)
{
- if(!mkdir("$LOGDIR/$i", 0755))
- {
- print STDERR "Error: mkdir($LOGDIR/$i): $!.\n";
- print STDERR "Error: please make sure that the $LOGDIR directory already exists and is writeable.\n";
- exit(1);
- }
+ die("Error: could not mkdir $LOGDIR/$i: $!.\n") unless(-e "$LOGDIR/$i" or mkdir("$LOGDIR/$i", 0755));
for ($j=1; $j<13; $j++)
{
- mkdir("$LOGDIR/$i/$j", 0755) or die("Error: could not mkdir $LOGDIR/$i/$j.\n");
+ die("Error: could not mkdir $LOGDIR/$i/$j: $!.\n") unless(-e "$LOGDIR/$i/$j" or mkdir("$LOGDIR/$i/$j", 0755));
for ($k=1; $k<32; $k++)
{
- mkdir("$LOGDIR/$i/$j/$k", 01777) or die("Error: could not mkdir $LOGDIR/$i/$j/$k.\n");
-
+ die("Error: could not mkdir $LOGDIR/$i/$j/$k: $!.\n") unless(-e "$LOGDIR/$i/$j/$k" or mkdir("$LOGDIR/$i/$j/$k", 0755));
}
}
}
-
-
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/2344493edfb16c98dc35bd6b6acd33f90b821438...5155d0c707b53da6f9f0b4064dd6036bb5f9f130
--
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/2344493edfb16c98dc35bd6b6acd33f90b821438...5155d0c707b53da6f9f0b4064dd6036bb5f9f130
You're receiving this email because of your account on xgitlab.cels.anl.gov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20210205/8dd4045a/attachment-0001.html>
More information about the Darshan-commits
mailing list