diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-30 00:19:11 +0200 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-30 00:19:11 +0200 |
commit | b009c5bafa63581a0c590a8c1a1d8dafd5e7654a (patch) | |
tree | cb143e0ebc9b75a2b6bcf399c299bdb307f78d42 /lib | |
parent | 73c6779067548fdbecd1627669c3cd93cc10d995 (diff) | |
download | pacman-b009c5bafa63581a0c590a8c1a1d8dafd5e7654a.tar.gz pacman-b009c5bafa63581a0c590a8c1a1d8dafd5e7654a.tar.xz |
checked for db_update() archive existence
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 9789f467..c8c8f3e1 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -222,6 +222,8 @@ int alpm_db_getlastupdate(PM_DB *db, char *ts) int alpm_db_update(PM_DB *db, char *archive, char *ts) { + struct stat buf; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -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 - stat() the archive to check it exists */ + if(stat(archive, &buf)) { + /* not found */ + RET_ERR(PM_ERR_NOT_A_FILE, -1); + } /* Cache needs to be rebuild */ db_free_pkgcache(db); |