summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-09 00:22:43 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-09 00:22:43 (EST)
commit642814351a88f15071b1aee34f769ee7a1a3beb7 (patch)
treeb1e9893c29fd084bb0b0641626b4a1fa9f343a24 /libopkg
parent2fdb3fc0b67757afd6fe7a244b6e14d2a546af0e (diff)
Fix lock_fd... How did I manage to break that?
Remove some redundant if statements too. git-svn-id: http://opkg.googlecode.com/svn/trunk@472 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg_conf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 69b6935..9d40a21 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -487,7 +487,8 @@ opkg_conf_init(const args_t *args)
else
sprintf_alloc (&lock_file, "%s/lock", OPKG_STATE_DIR_PREFIX);
- if (creat(lock_file, S_IRUSR | S_IWUSR | S_IRGRP) == -1) {
+ lock_fd = creat(lock_file, S_IRUSR | S_IWUSR | S_IRGRP);
+ if (lock_fd == -1) {
opkg_perror(ERROR, "Could not create lock file %s", lock_file);
free(lock_file);
return -1;
@@ -604,12 +605,9 @@ opkg_conf_deinit(void)
hash_print_stats(&conf->obs_file_hash);
}
- if (&conf->pkg_hash)
- pkg_hash_deinit();
- if (&conf->file_hash)
- hash_table_deinit(&conf->file_hash);
- if (&conf->obs_file_hash)
- hash_table_deinit(&conf->obs_file_hash);
+ pkg_hash_deinit();
+ hash_table_deinit(&conf->file_hash);
+ hash_table_deinit(&conf->obs_file_hash);
/* lockf may be defined with warn_unused_result */
if (lockf(lock_fd, F_ULOCK, (off_t)0) != 0) {