From fbad0421789856debcacf4d7138e39b08908a077 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 25 Sep 2004 02:39:07 -0400 Subject: [PATCH] can't reliably use `access' and W_OK --- main.cc | 9 ++------- quotes.cc | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/main.cc b/main.cc index cc26d433..c2b780b9 100644 --- a/main.cc +++ b/main.cc @@ -253,13 +253,8 @@ int parse_and_report(int argc, char * argv[], char * envp[]) // Configure the output stream std::ostream * out = &std::cout; - if (! config.output_file.empty()) { - if (access(config.output_file.c_str(), W_OK) == -1) - throw error(std::string("Cannot write output to file '" + - config.output_file + "'")); - else - out = new std::ofstream(config.output_file.c_str()); - } + if (! config.output_file.empty()) + out = new std::ofstream(config.output_file.c_str()); // Compile the format strings diff --git a/quotes.cc b/quotes.cc index 60e09117..4b1596ea 100644 --- a/quotes.cc +++ b/quotes.cc @@ -57,7 +57,7 @@ void quotes_by_script::operator()(commodity_t& commodity, price.parse(buf); commodity.add_price(now, price); - if (price && ! price_db.empty() && access(price_db.c_str(), W_OK) != -1) { + if (price && ! price_db.empty()) { char buf[128]; strftime(buf, 127, "%Y/%m/%d %H:%M:%S", localtime(&now)); ofstream database(price_db.c_str(), ios_base::out | ios_base::app);