[Midnightbsd-cvs] src [12180] stable/1.1: Fix a bug in mport package manager when creating packages with absolute paths.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Feb 18 19:32:13 EST 2019
Revision: 12180
http://svnweb.midnightbsd.org/src/?rev=12180
Author: laffer1
Date: 2019-02-18 19:32:13 -0500 (Mon, 18 Feb 2019)
Log Message:
-----------
Fix a bug in mport package manager when creating packages with absolute paths.
Modified Paths:
--------------
stable/1.1/lib/libmport/create_primative.c
stable/1.1/libexec/mport.check-fake/mport.check-fake.c
Modified: stable/1.1/lib/libmport/create_primative.c
===================================================================
--- stable/1.1/lib/libmport/create_primative.c 2019-02-19 00:28:54 UTC (rev 12179)
+++ stable/1.1/lib/libmport/create_primative.c 2019-02-19 00:32:13 UTC (rev 12180)
@@ -172,7 +172,7 @@
e->type == ASSET_FILE_OWNER_MODE) {
/* Don't prepend cwd onto absolute file paths (this is useful for update) */
if (e->data[0] == '/') {
- (void) strlcpy(file, e->data, FILENAME_MAX);
+ (void) snprintf(file, FILENAME_MAX, "%s%s", extra->sourcedir, e->data);
} else {
(void) snprintf(file, FILENAME_MAX, "%s/%s", cwd, e->data);
}
Modified: stable/1.1/libexec/mport.check-fake/mport.check-fake.c
===================================================================
--- stable/1.1/libexec/mport.check-fake/mport.check-fake.c 2019-02-19 00:28:54 UTC (rev 12179)
+++ stable/1.1/libexec/mport.check-fake/mport.check-fake.c 2019-02-19 00:32:13 UTC (rev 12180)
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD: src/libexec/mport.check-fake/mport.check-fake.c,v 1.7 2011/05/20 13:18:50 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
#include <stdlib.h>
#include <stdio.h>
@@ -158,9 +158,12 @@
if (e->type != ASSET_FILE)
continue;
-
- (void)snprintf(file, FILENAME_MAX, "%s%s/%s", destdir, cwd, e->data);
+ if (e->data[0] == '/')
+ (void)snprintf(file, FILENAME_MAX, "%s%s", destdir, e->data);
+ else
+ (void)snprintf(file, FILENAME_MAX, "%s%s/%s", destdir, cwd, e->data);
+
DIAG("checking %s", file)
if (lstat(file, &st) != 0) {
More information about the Midnightbsd-cvs
mailing list