All pastes #1633851 Raw Edit

teuf

public text v1 · immutable
#1633851 ·published 2009-10-20 22:17 UTC
rendered paste body
diff --git a/src/itdb_sqlite.c b/src/itdb_sqlite.cindex 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; 	}