aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt/pkg
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2016-12-25 23:15:38 +0800
committerbapt <bapt@FreeBSD.org>2016-12-25 23:15:38 +0800
commit55c9964f30d93105e931a4f05a04e5cd40f47da8 (patch)
tree80cf5a7815217604f17dfe15da17b46fd2192bac /ports-mgmt/pkg
parent83b3b0e0b31b7aff9c72725aec15fc6eb770811d (diff)
downloadfreebsd-ports-gnome-55c9964f30d93105e931a4f05a04e5cd40f47da8.tar.gz
freebsd-ports-gnome-55c9964f30d93105e931a4f05a04e5cd40f47da8.tar.zst
freebsd-ports-gnome-55c9964f30d93105e931a4f05a04e5cd40f47da8.zip
Fix file descriptor leak that might lead to errors on packages with lots of files
PR: 215544 Submitted by: pasokondokoro@gmail.com
Diffstat (limited to 'ports-mgmt/pkg')
-rw-r--r--ports-mgmt/pkg/Makefile1
-rw-r--r--ports-mgmt/pkg/files/patch-libpkg_pkg__add.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/ports-mgmt/pkg/Makefile b/ports-mgmt/pkg/Makefile
index b05778f0f0fe..4a630c98f1e6 100644
--- a/ports-mgmt/pkg/Makefile
+++ b/ports-mgmt/pkg/Makefile
@@ -2,6 +2,7 @@
PORTNAME= pkg
DISTVERSION= 1.9.4
+PORTREVISION= 1
_PKG_VERSION= ${DISTVERSION}
CATEGORIES= ports-mgmt
MASTER_SITES= \
diff --git a/ports-mgmt/pkg/files/patch-libpkg_pkg__add.c b/ports-mgmt/pkg/files/patch-libpkg_pkg__add.c
new file mode 100644
index 000000000000..e12299348409
--- /dev/null
+++ b/ports-mgmt/pkg/files/patch-libpkg_pkg__add.c
@@ -0,0 +1,22 @@
+--- libpkg/pkg_add.c.orig 2016-12-25 15:12:01 UTC
++++ libpkg/pkg_add.c
+@@ -1344,8 +1344,10 @@ pkg_add_fromdir(struct pkg *pkg, const c
+ }
+ kh_find(hls, hardlinks, st.st_ino, path);
+ if (path != NULL) {
+- if (create_hardlink(pkg, f, path) == EPKG_FATAL)
++ if (create_hardlink(pkg, f, path) == EPKG_FATAL) {
++ close(fd);
+ return (EPKG_FATAL);
++ }
+ } else {
+ if (create_regfile(pkg, f, NULL, NULL, fd, NULL) == EPKG_FATAL) {
+ close(fd);
+@@ -1353,6 +1355,7 @@ pkg_add_fromdir(struct pkg *pkg, const c
+ }
+ kh_safe_add(hls, hardlinks, f->path, st.st_ino);
+ }
++ close(fd);
+ } else {
+ pkg_emit_error("Invalid file type");
+ return (EPKG_FATAL);