View | Details | Raw Unified | Return to bug 186671 | Differences between
and this patch

Collapse All | Expand All

(-)ports-mgmt/pkg/files/patch-pkg_version.c (+28 lines)
Line 0 Link Here
1
--- pkg/version.c.orig	2014-02-02 05:33:30.000000000 +1100
2
+++ pkg/version.c	2014-02-13 15:34:07.000000000 +1100
3
@@ -318,7 +318,7 @@
4
 				opt |= VERSION_SOURCE_REMOTE;
5
 		}
6
 
7
-		if (!have_ports && (opt & (VERSION_SOURCE_INDEX|VERSION_SOURCE_PORTS)))
8
+		if (!have_ports && (opt & VERSION_SOURCE_PORTS))
9
 			err(1, "Unable to open ports directory %s", portsdir);
10
 
11
 		/* Only force remote mode if looking up remote, otherwise
12
@@ -341,9 +341,13 @@
13
 			goto cleanup;
14
 
15
 		if (opt & VERSION_SOURCE_INDEX) {
16
-			uname(&u);
17
-			rel_major_ver = (int) strtol(u.release, NULL, 10);
18
-			snprintf(indexpath, sizeof(indexpath), "%s/INDEX-%d", portsdir, rel_major_ver);
19
+			if (argc == 1) {
20
+				snprintf(indexpath, sizeof(indexpath), "%s", argv[0]);
21
+			} else {
22
+				uname(&u);
23
+				rel_major_ver = (int) strtol(u.release, NULL, 10);
24
+				snprintf(indexpath, sizeof(indexpath), "%s/INDEX-%d", portsdir, rel_major_ver);
25
+			}
26
 			indexfile = fopen(indexpath, "r");
27
 			if (!indexfile)
28
 				err(EX_SOFTWARE, "Unable to open %s!", indexpath);

Return to bug 186671