[disorderfs] 01/01: Fix resolution of ROOTDIR

Andrew Ayer agwa at andrewayer.name
Tue Sep 13 17:07:33 UTC 2016


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

agwa-guest pushed a commit to branch master
in repository disorderfs.

commit cfec65e65fe346a45772e97e1a4f5a30fd2d95e7
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Tue Sep 13 10:06:38 2016 -0700

    Fix resolution of ROOTDIR
    
    * Print error message if realpath fails (e.g. path does not exist).
    * Avoid memory leak.
---
 disorderfs.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/disorderfs.cpp b/disorderfs.cpp
index 8393e3b..ce93bcf 100644
--- a/disorderfs.cpp
+++ b/disorderfs.cpp
@@ -251,7 +251,13 @@ int	main (int argc, char** argv)
 		return 2;
 	}
 
-	root = realpath(bare_arguments[0].c_str(), NULL);
+	if (char* resolved_path = realpath(bare_arguments[0].c_str(), nullptr)) {
+		root = resolved_path;
+		std::free(resolved_path);
+	} else {
+		std::perror(bare_arguments[0].c_str());
+		return 1;
+	}
 
 	// Add some of our own hard-coded FUSE options:
 	fuse_opt_add_arg(&fargs, "-o");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/disorderfs.git



More information about the Reproducible-commits mailing list