[BusyBox] tar is _not_ cowardly enough!
Steven Scholz
steven.scholz at imc-berlin.de
Wed Nov 19 11:39:33 UTC 2003
Hi there,
when accidentally typing
tar cvzf control.tar.gz
where control.tar.gz is an existing archive tar tells me
tar: Cowardly refusing to create an empty archive
Fair enough. But tar is still unlinking the existing archive!
The tar on my host behaves different. It's not unlinking the tar file if there's
nothing to tar.
We should fixed that, i.e. checking tar_handle->accept before unlinking in
archival/tar.c:
#ifdef CONFIG_FEATURE_TAR_CREATE
- if (ctx_flag == CTX_CREATE) {
+ if ((ctx_flag == CTX_CREATE) && (tar_handle->accept != NULL)) {
tar_stream = stdout;
flags = O_WRONLY | O_CREAT | O_EXCL;
unlink(tar_filename);
Shouldn't we?
Steven
More information about the busybox
mailing list