#if !ENABLE_FEATURE_SEAMLESS_GZ && !ENABLE_FEATURE_SEAMLESS_BZ2
/* Do not pass gzip flag to writeTarFile() */
-#define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \
- writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude)
+#define writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude, gzip) \
+ writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude)
#endif
/* gcc 4.2.1 inlines it, making code bigger */
static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
- int dereferenceFlag, const llist_t *include,
+ int recurseFlags, const llist_t *include,
const llist_t *exclude, int gzip)
{
int errorFlag = FALSE;
/* Read the directory/files and iterate over them one at a time */
while (include) {
- if (!recursive_action(include->data, ACTION_RECURSE |
- (dereferenceFlag ? ACTION_FOLLOWLINKS : 0),
+ if (!recursive_action(include->data, recurseFlags,
writeFileToTarball, writeFileToTarball, &tbInfo, 0)
) {
errorFlag = TRUE;
}
#else
int writeTarFile(int tar_fd, int verboseFlag,
- int dereferenceFlag, const llist_t *include,
+ int recurseFlags, const llist_t *include,
const llist_t *exclude, int gzip);
#endif /* FEATURE_TAR_CREATE */
// o no-same-owner
// p same-permissions
// k keep-old
+// no-recursion
// numeric-owner
// no-same-permissions
// overwrite
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit
IF_FEATURE_TAR_NOPRESERVE_TIME(OPTBIT_NOPRESERVE_TIME,)
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
+ OPTBIT_NORECURSION,
IF_FEATURE_TAR_TO_COMMAND(OPTBIT_2COMMAND ,)
OPTBIT_NUMERIC_OWNER,
OPTBIT_NOPRESERVE_PERM,
OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
OPT_NOPRESERVE_TIME = IF_FEATURE_TAR_NOPRESERVE_TIME((1 << OPTBIT_NOPRESERVE_TIME)) + 0, // m
+ OPT_NORECURSION = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NORECURSION )) + 0, // no-recursion
OPT_2COMMAND = IF_FEATURE_TAR_TO_COMMAND( (1 << OPTBIT_2COMMAND )) + 0, // to-command
OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner
OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions
# if ENABLE_FEATURE_TAR_NOPRESERVE_TIME
"touch\0" No_argument "m"
# endif
+ "no-recursion\0" No_argument "\xfa"
# if ENABLE_FEATURE_TAR_TO_COMMAND
"to-command\0" Required_argument "\xfb"
# endif
zipMode = 2;
#endif
/* NB: writeTarFile() closes tar_handle->src_fd */
- return writeTarFile(tar_handle->src_fd, verboseFlag, opt & OPT_DEREFERENCE,
+ return writeTarFile(tar_handle->src_fd, verboseFlag,
+ (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0)
+ | (opt & OPT_NORECURSION ? 0 : ACTION_RECURSE),
tar_handle->accept,
tar_handle->reject, zipMode);
}