#include "pkgproc.h"
#include "pkgtask.h"
+#include "mkpath.h"
+
#define PKGERR_INVALID_MANIFEST( REASON ) \
PKGMSG_INVALID_MANIFEST, tarname, REASON
* the absolute path name, and attempt to "rmdir" it, setting
* return value as appropriate; silently ignore failure.
*/
- char fullpath[ 1 + snprintf( NULL, 0, pkg_path_format, sysroot, pathname ) ];
- snprintf( fullpath, sizeof( fullpath ), pkg_path_format, sysroot, pathname );
+ char fullpath[ mkpath( NULL, sysroot, pathname, NULL ) ];
+ mkpath( fullpath, sysroot, pathname, NULL );
DEBUG_INVOKE_IF( DEBUGLEVEL & DEBUG_TRACE_TRANSACTIONS,
dmh_printf( " %s: rmdir\n", fullpath )
int retval = 0;
if( (sysroot != NULL) && (pathname != NULL) )
{
- char filepath[ 1 + snprintf( NULL, 0, pkg_path_format, sysroot, pathname ) ];
- snprintf( filepath, sizeof( filepath ), pkg_path_format, sysroot, pathname );
+ char filepath[ mkpath( NULL, sysroot, pathname, NULL ) ];
+ mkpath( filepath, sysroot, pathname, NULL );
DEBUG_INVOKE_IF( DEBUGLEVEL & DEBUG_TRACE_TRANSACTIONS,
dmh_printf( " %s: unlink file\n", filepath )
/* The manifest records file pathnames relative to sysroot;
* thus, first identify the pathname prefix which identifies
* the absolute locations of the files and directories which
- * are to be purged.
+ * are to be purged; (note that we specify this as a template
+ * for use with mkpath(), rather than as a simple path name,
+ * so that macros--esp. "%R"--may be correctly resolved at
+ * point of use).
*/
- const char *syspath = pathname_lookup( sysroot, value_unknown );
+ const char *refpath = pathname_lookup( sysroot, value_unknown );
+ char syspath[4 + strlen( refpath )]; sprintf( syspath, "%s%%/F", refpath );
/* Read the package manifest...
*/