svn commit: r455589 - in head/ports-mgmt/pkg: . files
Baptiste Daroussin
bapt at FreeBSD.org
Tue Dec 5 16:22:03 UTC 2017
Author: bapt
Date: Tue Dec 5 16:22:01 2017
New Revision: 455589
URL: https://svnweb.freebsd.org/changeset/ports/455589
Log:
Fix segfault in pkg version against the ports tree
PR: 224023
Reported by: jrm, kib, Trond.Endrestol at ximalas.info
Tested by: jrm (an early version of the patch)
Added:
head/ports-mgmt/pkg/files/patch-src_version.c (contents, props changed)
Modified:
head/ports-mgmt/pkg/Makefile
Modified: head/ports-mgmt/pkg/Makefile
==============================================================================
--- head/ports-mgmt/pkg/Makefile Tue Dec 5 16:20:56 2017 (r455588)
+++ head/ports-mgmt/pkg/Makefile Tue Dec 5 16:22:01 2017 (r455589)
@@ -2,6 +2,7 @@
PORTNAME= pkg
DISTVERSION= 1.10.3
+PORTREVISION= 1
_PKG_VERSION= ${DISTVERSION}
CATEGORIES= ports-mgmt
MASTER_SITES= \
Added: head/ports-mgmt/pkg/files/patch-src_version.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/ports-mgmt/pkg/files/patch-src_version.c Tue Dec 5 16:22:01 2017 (r455589)
@@ -0,0 +1,28 @@
+diff --git src/version.c src/version.c
+index d265776b..92c18060 100644
+--- src/version.c
++++ src/version.c
+@@ -601,6 +601,8 @@ exec_buf(UT_string *res, char **argv) {
+ if (errno != EINTR)
+ return (-1);
+ }
++ if (WEXITSTATUS(pstat) != 0)
++ return (-1);
+
+ return (utstring_len(res));
+ }
+@@ -716,11 +718,13 @@ port_version(UT_string *cmd, const char *portsdir, const char *origin,
+ argv[3] = "flavors-package-names";
+ argv[4] = NULL;
+
+- if (exec_buf(cmd, argv) != 0) {
++ if (exec_buf(cmd, argv) > 0) {
+ output = utstring_body(cmd);
+ while ((walk = strsep(&output, "\n")) != NULL) {
+ name = walk;
+ walk = strrchr(walk, '-');
++ if (walk == NULL)
++ continue;
+ walk[0] = '\0';
+ walk++;
+ if (strcmp(name, pkgname) == 0) {
More information about the svn-ports-head
mailing list