[sdpb] 223/233: Check outFile permission before proceeding

Tobias Hansen thansen at moszumanska.debian.org
Thu Mar 9 04:06:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository sdpb.

commit fb5de5699f44997dccfd6b4779cb7ee871b8c9a8
Author: Connor Behan <connor.behan at gmail.com>
Date:   Sun Aug 28 22:49:19 2016 -0400

    Check outFile permission before proceeding
    
    This can save time if someone accidentally runs SDPB in the wrong place.
---
 src/main.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/main.cpp b/src/main.cpp
index 94fa73a..65350d0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -232,6 +232,13 @@ int main(int argc, char** argv) {
       checkpointFile = sdpFile;
       checkpointFile.replace_extension("ck");
     }
+
+    std::ofstream ofs(outFile.string().c_str());
+    ofs.close();
+    if (!ofs) {
+      cerr << "Cannot write to outFile." << endl;
+      return 1;
+    }
   } catch(po::error& e) {
     cerr << "ERROR: " << e.what() << endl;
     cerr << cmdLineOptions << endl;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sdpb.git



More information about the debian-science-commits mailing list