[Midnightbsd-cvs] src [7512] trunk/lib/libmport/bundle_read_install_pkg.c: fix path issue on deletes by catching absolute paths and storing them properly in the master database.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Apr 9 17:01:25 EDT 2016
Revision: 7512
http://svnweb.midnightbsd.org/src/?rev=7512
Author: laffer1
Date: 2016-04-09 17:01:24 -0400 (Sat, 09 Apr 2016)
Log Message:
-----------
fix path issue on deletes by catching absolute paths and storing them properly in the master database. This should help with verify as well.
Modified Paths:
--------------
trunk/lib/libmport/bundle_read_install_pkg.c
Modified: trunk/lib/libmport/bundle_read_install_pkg.c
===================================================================
--- trunk/lib/libmport/bundle_read_install_pkg.c 2016-04-09 20:30:07 UTC (rev 7511)
+++ trunk/lib/libmport/bundle_read_install_pkg.c 2016-04-09 21:01:24 UTC (rev 7512)
@@ -398,7 +398,11 @@
goto ERROR;
}
} else if (type == ASSET_DIR || type == ASSET_DIRRM || type == ASSET_DIRRMTRY) {
- (void) snprintf(dir, FILENAME_MAX, "%s/%s", cwd, data);
+ /* if data starts with /, it's most likely an absolute path. Don't prepend cwd */
+ if (data != NULL && data[0] == '/')
+ (void) snprintf(dir, FILENAME_MAX, "%s", data);
+ else
+ (void) snprintf(dir, FILENAME_MAX, "%s/%s", cwd, data);
if (sqlite3_bind_text(insert, 2, dir, -1, SQLITE_STATIC) != SQLITE_OK) {
SET_ERROR(MPORT_ERR_FATAL, sqlite3_errmsg(db));
More information about the Midnightbsd-cvs
mailing list