checked for db_update() archive existence

This commit is contained in:
Aurelien Foret 2005-03-29 22:19:11 +00:00
parent 73c6779067
commit b009c5bafa

View file

@ -222,6 +222,8 @@ int alpm_db_getlastupdate(PM_DB *db, char *ts)
int alpm_db_update(PM_DB *db, char *archive, char *ts) int alpm_db_update(PM_DB *db, char *archive, char *ts)
{ {
struct stat buf;
/* Sanity checks */ /* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1)); ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
@ -239,8 +241,10 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
} }
} }
/* ORE if(stat(archive, &buf)) {
stat() the archive to check it exists */ /* not found */
RET_ERR(PM_ERR_NOT_A_FILE, -1);
}
/* Cache needs to be rebuild */ /* Cache needs to be rebuild */
db_free_pkgcache(db); db_free_pkgcache(db);