Skip to content

Commit

Permalink
Don't print error if unlinking file failed because it didn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Apr 26, 2014
1 parent 26c9b58 commit d2930d3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c
Expand Up @@ -251,10 +251,8 @@ static int mod_instantiate(CONF_SECTION *conf, rlm_sql_config_t *config)

if (stat(driver->filename, &buf) == 0) {
exists = true;

} else if (errno == ENOENT) {
exists = false;

} else {
ERROR("rlm_sql_sqlite: Database exists, but couldn't be opened: %s", fr_syserror(errno));
return -1;
Expand Down Expand Up @@ -322,10 +320,10 @@ static int mod_instantiate(CONF_SECTION *conf, rlm_sql_config_t *config)
goto unlink;
}
if (ret < 0) {
unlink:
if (unlink(driver->filename) < 0) {
unlink:
if ((unlink(driver->filename) < 0) && (errno != ENOENT)) {
ERROR("rlm_sql_sqlite: Error removing partially initialised database: %s",
fr_syserror(errno));
fr_syserror(errno));
}
return -1;
}
Expand Down

0 comments on commit d2930d3

Please sign in to comment.