[pacman-dev] [PATCH] Remove an usused variable from alpm/util.c/_alpm_lckmk()
Nagy Gabor
ngaba at bibl.u-szeged.hu
Sun Aug 17 15:35:44 EDT 2008
From 7e7e2b74ff03dc0656879ed9ae6f171a82194ea4 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Sun, 17 Aug 2008 21:26:49 +0200
Subject: [PATCH] Remove an usused variable from alpm/util.c/_alpm_lckmk()
Probably a tweakable "lockdb-retry" option was planned which is not
implemented. (Now it should be implemented in front-end.)
So now this variable was unused and caused a small memleak.
(FREE(dir) was not reached in case of error.)
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
lib/libalpm/util.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 2847db7..b26c970 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -241,7 +241,7 @@ char *_alpm_strreplace(const char *str, const char *needle, const char *replace)
/* Create a lock file */
int _alpm_lckmk()
{
- int fd, count = 0;
+ int fd;
char *dir, *ptr;
const char *file = alpm_option_get_lockfile();
@@ -252,17 +252,9 @@ int _alpm_lckmk()
*ptr = '\0';
}
_alpm_makepath(dir);
-
- while((fd = open(file, O_WRONLY | O_CREAT | O_EXCL, 0000)) == -1 && errno == EACCES) {
- if(++count < 1) {
- sleep(1);
- } else {
- return(-1);
- }
- }
-
FREE(dir);
+ fd = open(file, O_WRONLY | O_CREAT | O_EXCL, 0000);
return(fd > 0 ? fd : -1);
}
--
1.5.6.5
More information about the pacman-dev
mailing list