summaryrefslogtreecommitdiff
path: root/src/controller.cpp
diff options
context:
space:
mode:
authorGravatar Alexander Batischev <eual.jp@gmail.com> 2017-09-19 21:04:51 +0300
committerGravatar Alexander Batischev <eual.jp@gmail.com> 2017-09-20 21:02:26 +0300
commitf5c68cd8e00b3c83e8fb047a1bac3cfda3b1f9e2 (patch)
treef29f75955a305eda17dcd820fc3009f8303011e6 /src/controller.cpp
parent8ea9f9f61aef64d70159e4f5788fd40c12163380 (diff)
downloadnewsboat-f5c68cd8e00b3c83e8fb047a1bac3cfda3b1f9e2.tar.gz
newsboat-f5c68cd8e00b3c83e8fb047a1bac3cfda3b1f9e2.tar.zst
newsboat-f5c68cd8e00b3c83e8fb047a1bac3cfda3b1f9e2.zip
Don't migrate if urls file exists but isn't readable
Diffstat (limited to 'src/controller.cpp')
-rw-r--r--src/controller.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/controller.cpp b/src/controller.cpp
index aff4b452..482b2b66 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -163,7 +163,7 @@ bool controller::setup_dirs_xdg(const char *env_home, bool silent) {
return true;
}
-bool controller::setup_dirs(bool silent) {
+void controller::setup_dirs(bool silent) {
const char * env_home;
if (!(env_home = ::getenv("HOME"))) {
struct passwd * spw = ::getpwuid(::getuid());
@@ -181,9 +181,7 @@ bool controller::setup_dirs(bool silent) {
config_dir.append(NEWSBOAT_CONFIG_SUBDIR);
if (setup_dirs_xdg(env_home, silent))
- return false;
-
- bool first_run = ! (0 == access(config_dir.c_str(), R_OK | X_OK));
+ return;
url_file = config_dir + std::string(NEWSBEUTER_PATH_SEP) + url_file;
cache_file = config_dir + std::string(NEWSBEUTER_PATH_SEP) + cache_file;
@@ -193,8 +191,6 @@ bool controller::setup_dirs(bool silent) {
searchfile = strprintf::fmt("%s%shistory.search", config_dir, NEWSBEUTER_PATH_SEP);
cmdlinefile = strprintf::fmt("%s%shistory.cmdline", config_dir, NEWSBEUTER_PATH_SEP);
-
- return first_run;
}
void copy_file(
@@ -487,7 +483,7 @@ void controller::run(int argc, char * argv[]) {
LOG(level::INFO, "nl_langinfo(CODESET): %s", nl_langinfo(CODESET));
- if ((! using_nonstandard_configs) && (0 != access(url_file.c_str(), R_OK))) {
+ if ((! using_nonstandard_configs) && (0 != access(url_file.c_str(), F_OK))) {
migrate_data_from_newsbeuter(silent);
} else {
utils::mkdir_parents(config_dir.c_str(), 0700);