diff --git a/src/itdb_sqlite.c b/src/itdb_sqlite.c index a4eac73..24240b1 100644 --- a/src/itdb_sqlite.c +++ b/src/itdb_sqlite.c @@ -1025,21 +1025,13 @@ static void mk_Locations(Itdb_iTunesDB *itdb, const char *outpath, const char *u sqlite3_stmt *stmt = NULL; const char *sqltail = NULL; char *errmsg = NULL; - struct stat fst; int idx = 0; dbf = g_build_filename(outpath, "Locations.itdb", NULL); printf("[%s] Processing '%s'\n", __func__, dbf); - if (stat(dbf, &fst) != 0) { - if (errno == ENOENT) { - /* file is not present. so we will create it */ - } else { - fprintf(stderr, "[%s] Error: stat: %s\n", __func__, strerror(errno)); - goto leave; - } - } else { - /* file is present. delete it, we'll re-create it. */ - if (unlink(dbf) != 0) { + /* file is present. delete it, we'll re-create it. */ + if (g_unlink(dbf) != 0) { + if (errno != ENOENT) { fprintf(stderr, "[%s] could not delete '%s': %s\n", __func__, dbf, strerror(errno)); goto leave; }