From 0874eeb6d283143981da4ecb1dd669cb4ba0a142 Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 19 Nov 2009 07:46:34 +0000 Subject: [PATCH] eror reporting git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@590 e16421f0-f15b-0410-abcd-98678b794739 --- hashtree.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hashtree.cpp b/hashtree.cpp index b278a2f..1c17153 100644 --- a/hashtree.cpp +++ b/hashtree.cpp @@ -84,8 +84,10 @@ peak_count_(0), hashes_(NULL), size_(0), sizek_(0), complete_(0), completek_(0) { fd_ = open(filename,OPENFLAGS,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); - if (fd_<0) + if (fd_<0) { + print_error("cannot open the file"); return; + } char hfn[1024] = ""; if (!hash_filename) { strcat(hfn, filename); @@ -93,8 +95,10 @@ complete_(0), completek_(0) } else strcpy(hfn,hash_filename); hash_fd_ = open(hfn,OPENFLAGS,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); - if (hash_fd_<0) + if (hash_fd_<0) { + print_error("cannot open hash file"); return; + } if (root_hash_==Sha1Hash::ZERO) { // fresh submit, hash it assert(file_size(fd_)); Submit(); -- 2.20.1