xbps_repo_open: open archive read-only if lock is not set.

This commit is contained in:
Juan RP 2014-09-05 12:39:53 +02:00
parent 013731c502
commit bf92d1f5a3

View File

@ -151,7 +151,11 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock)
/* /*
* Open or create the repository archive. * Open or create the repository archive.
*/ */
if (lock)
repo->fd = open(repofile, O_CREAT|O_RDWR, 0664); repo->fd = open(repofile, O_CREAT|O_RDWR, 0664);
else
repo->fd = open(repofile, O_RDONLY);
if (repo->fd == -1) { if (repo->fd == -1) {
xbps_dbg_printf(xhp, "[repo] `%s' open repodata %s\n", xbps_dbg_printf(xhp, "[repo] `%s' open repodata %s\n",
repofile, strerror(errno)); repofile, strerror(errno));