/* 64KiB is the minimum blksize to best minimize system call overhead. */
#define COPY_FILE_BUFLEN 65536
+int link_append_flag = 0;
+
static int ext2_file_type(unsigned int mode)
{
if (LINUX_S_ISREG(mode))
}
retval = ext2fs_link(fs, parent_ino, name, ino,
- ext2_file_type(inode.i_mode));
+ ext2_file_type(inode.i_mode) | link_append_flag);
if (retval == EXT2_ET_DIR_NO_SPACE) {
retval = ext2fs_expand_dir(fs, parent_ino);
if (retval) {
return retval;
}
retval = ext2fs_link(fs, parent_ino, name, ino,
- ext2_file_type(inode.i_mode));
+ (ext2_file_type(inode.i_mode) |
+ link_append_flag));
}
if (retval) {
com_err(__func__, retval, _("while linking \"%s\""), name);
#ifdef DEBUGFS
printf("Allocated inode: %u\n", ino);
#endif
- retval = ext2fs_link(fs, cwd, name, ino, filetype);
+ retval = ext2fs_link(fs, cwd, name, ino, filetype | link_append_flag);
if (retval == EXT2_ET_DIR_NO_SPACE) {
retval = ext2fs_expand_dir(fs, cwd);
if (retval) {
_("while expanding directory"));
return retval;
}
- retval = ext2fs_link(fs, cwd, name, ino, filetype);
+ retval = ext2fs_link(fs, cwd, name, ino,
+ filetype | link_append_flag);
}
if (retval) {
com_err(name, retval, _("while creating inode \"%s\""), name);
#ifdef DEBUGFS
printf("Allocated inode: %u\n", newfile);
#endif
- retval = ext2fs_link(fs, parent_ino, dest, newfile, EXT2_FT_REG_FILE);
+ retval = ext2fs_link(fs, parent_ino, dest, newfile,
+ EXT2_FT_REG_FILE | link_append_flag);
if (retval == EXT2_ET_DIR_NO_SPACE) {
retval = ext2fs_expand_dir(fs, parent_ino);
if (retval)
goto out;
retval = ext2fs_link(fs, parent_ino, dest, newfile,
- EXT2_FT_REG_FILE);
+ EXT2_FT_REG_FILE | link_append_flag);
}
if (retval)
goto out;
file_info.path_max_len = 255;
file_info.path = calloc(file_info.path_max_len, 1);
+ link_append_flag = (flags & POPULATE_FS_LINK_APPEND) ?
+ EXT2FS_LINK_APPEND : 0;
+
/* interpret input as tarball either if it's "-" (stdin) or if it's
* a regular file (or a symlink pointing to a regular file)
*/
if (stat(source, &st)) {
retval = errno;
com_err(__func__, retval, _("while calling stat"));
- return retval;
+ goto out;
}
if (S_ISREG(st.st_mode)) {
retval = __populate_fs_from_tar(fs, parent_ino, source, root,
out:
free(file_info.path);
free(hdlinks.hdl);
+ link_append_flag = 0;
return retval;
}
#include "create_inode_libarchive.h"
#include "support/nls-enable.h"
+extern int link_append_flag;
+
#if (!(defined(CONFIG_DLOPEN_LIBARCHIVE) || defined(HAVE_ARCHIVE_H)) || \
defined(CONFIG_DISABLE_LIBARCHIVE))
#ifdef DEBUGFS
printf("Allocated inode: %u\n", newfile);
#endif
- retval = ext2fs_link(fs, cwd, dest, newfile, EXT2_FT_REG_FILE);
+ retval = ext2fs_link(fs, cwd, dest, newfile,
+ EXT2_FT_REG_FILE | link_append_flag);
if (retval == EXT2_ET_DIR_NO_SPACE) {
retval = ext2fs_expand_dir(fs, cwd);
if (retval)
goto out;
- retval = ext2fs_link(fs, cwd, dest, newfile, EXT2_FT_REG_FILE);
+ retval = ext2fs_link(fs, cwd, dest, newfile,
+ EXT2_FT_REG_FILE | link_append_flag);
}
if (retval)
goto out;