xbps_repo_close: only unlock the file lock if repo was opened as such.

If xbps_repo_open() was called with the lock arg set, xbps_repo_close()
will now unlock the repo file lock, without the need to set it.

This avoids the need to always unlock the file lock even if it wasn't
locked previously. This also introduceds an ABI/API break, but this
way it's cleaner.
This commit is contained in:
Juan RP
2015-01-11 09:11:38 +01:00
parent 9aaff4e2d0
commit b23855f692
7 changed files with 18 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2012-2014 Juan Romero Pardines.
* Copyright (c) 2012-2015 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -216,7 +216,7 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
out:
if (repo)
xbps_repo_close(repo, true);
xbps_repo_close(repo);
if (tmprepodir)
free(tmprepodir);