pkg_install-20090301:

Plug a number of file descriptor leaks.
This commit is contained in:
joerg 2009-03-02 14:59:14 +00:00
parent 855cf9be6b
commit af07339813
5 changed files with 24 additions and 13 deletions

View file

@ -1,4 +1,4 @@
/* $NetBSD: perform.c,v 1.81 2009/02/28 16:03:56 joerg Exp $ */
/* $NetBSD: perform.c,v 1.82 2009/03/02 14:59:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@ -6,7 +6,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: perform.c,v 1.81 2009/02/28 16:03:56 joerg Exp $");
__RCSID("$NetBSD: perform.c,v 1.82 2009/03/02 14:59:14 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
@ -357,6 +357,7 @@ check_already_installed(struct pkg_task *pkg)
warnx("package `%s' already recorded as installed",
pkg->pkgname);
}
close(fd);
return 0;
}
@ -549,6 +550,7 @@ write_meta_data(struct pkg_task *pkg)
warn("Can't write meta data file: %s",
filename);
free(filename);
close(fd);
return -1;
}
len -= ret;
@ -771,12 +773,14 @@ pkg_register_depends(struct pkg_task *pkg)
required_by = pkgdb_pkg_file(pkg->dependencies[i], REQUIRED_BY_FNAME);
fd = open(required_by, O_WRONLY | O_APPEND | O_CREAT, 0644);
if (fd == -1)
if (fd == -1) {
warn("can't open dependency file '%s',"
"registration is incomplete!", required_by);
else if (write(fd, text, text_len) != text_len)
close(fd);
} else if (write(fd, text, text_len) != text_len) {
warn("can't write to dependency file `%s'", required_by);
else if (close(fd) == -1)
close(fd);
} else if (close(fd) == -1)
warn("cannot close file %s", required_by);
free(required_by);

View file

@ -1,4 +1,4 @@
/* $NetBSD: pkcs7.c,v 1.3 2009/02/16 20:59:11 joerg Exp $ */
/* $NetBSD: pkcs7.c,v 1.4 2009/03/02 14:59:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: pkcs7.c,v 1.3 2009/02/16 20:59:11 joerg Exp $");
__RCSID("$NetBSD: pkcs7.c,v 1.4 2009/03/02 14:59:14 joerg Exp $");
/*-
* Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@ -105,6 +105,7 @@ file_to_certs(const char *file)
}
sk_X509_free(certs);
warnx("Can't read certificate in file: %s", file);
fclose(f);
return NULL;
}
sk_X509_insert(certs, cert, sk_X509_num(certs));

View file

@ -1,4 +1,4 @@
/* $NetBSD: pkg_signature.c,v 1.5 2009/02/13 13:17:41 joerg Exp $ */
/* $NetBSD: pkg_signature.c,v 1.6 2009/03/02 14:59:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: pkg_signature.c,v 1.5 2009/02/13 13:17:41 joerg Exp $");
__RCSID("$NetBSD: pkg_signature.c,v 1.6 2009/03/02 14:59:14 joerg Exp $");
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg@NetBSD.org>.
@ -614,6 +614,8 @@ pkg_sign_x509(const char *name, const char *output, const char *key_file, const
archive_write_finish(pkg);
close(fd);
exit(0);
}
#endif
@ -706,5 +708,7 @@ pkg_sign_gpg(const char *name, const char *output)
archive_write_finish(pkg);
close(fd);
exit(0);
}

View file

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.115 2009/02/28 16:03:56 joerg Exp $ */
/* $NetBSD: version.h,v 1.116 2009/03/02 14:59:14 joerg Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@ -27,6 +27,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
#define PKGTOOLS_VERSION "20090228"
#define PKGTOOLS_VERSION "20090301"
#endif /* _INST_LIB_VERSION_H_ */

View file

@ -1,4 +1,4 @@
/* $NetBSD: vulnerabilities-file.c,v 1.4 2009/02/02 12:35:01 joerg Exp $ */
/* $NetBSD: vulnerabilities-file.c,v 1.5 2009/03/02 14:59:14 joerg Exp $ */
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg@NetBSD.org>.
@ -38,7 +38,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: vulnerabilities-file.c,v 1.4 2009/02/02 12:35:01 joerg Exp $");
__RCSID("$NetBSD: vulnerabilities-file.c,v 1.5 2009/03/02 14:59:14 joerg Exp $");
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
@ -368,6 +368,8 @@ read_pkg_vulnerabilities(const char *path, int ignore_missing, int check_sum)
if (bytes_read != st.st_size)
errx(1, "Unexpected short read");
close(fd);
if (decompress_buffer(input, input_len, &decompressed_input,
&decompressed_len)) {
free(input);