summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorLaszlo Papp <djszapi2@gmail.com>2009-11-13 00:59:34 +0100
committerDan McGee <dan@archlinux.org>2009-11-15 19:40:56 -0600
commitbe266b43647ef57632d7bcfd07a4441f737b5aed (patch)
tree43fea67e6a00849a6328cdffed0a4a7dc723fd28 /lib/libalpm/trans.c
parent120cd312e49b9fbb844dd36c71fe1f2e2910b707 (diff)
downloadpacman-be266b43647ef57632d7bcfd07a4441f737b5aed.tar.xz
Refactor do/while cycle and multiple while cycles
* It makes the code clearer to read/understand * Cppcheck tool doesn't show this anymore: [./util.c:215]: (error) Resource leak: fd [Dan: don't change the coding style] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index aea71db1..4879d236 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -261,7 +261,10 @@ int SYMEXPORT alpm_trans_release()
/* unlock db */
if(!nolock_flag) {
if(handle->lckfd != -1) {
- while(close(handle->lckfd) == -1 && errno == EINTR);
+ int fd;
+ do {
+ fd = close(handle->lckfd);
+ } while(fd == -1 && errno == EINTR);
handle->lckfd = -1;
}
if(_alpm_lckrm()) {