Add ARCHIVE_EXTRACT_UNLINK option to permit clients to

control how archive_extract handles pre-existing files.
(Not implemented yet, but documented.)
This commit is contained in:
kientzle 2004-03-06 01:05:32 +00:00
parent a5593bba62
commit 4a051cce65
3 changed files with 7 additions and 0 deletions

View File

@ -190,6 +190,7 @@ ssize_t archive_read_data_into_fd(struct archive *, int fd);
#define ARCHIVE_EXTRACT_PERM (2) /* Default: restore perm only for reg file*/
#define ARCHIVE_EXTRACT_TIME (4) /* Default: mod time not restored */
#define ARCHIVE_EXTRACT_NO_OVERWRITE (8) /* Default: Replace files on disk */
#define ARCHIVE_EXTRACT_UNLINK (16) /* Default: don't unlink existing files */
int archive_read_extract(struct archive *, struct archive_entry *,
int flags);

View File

@ -190,6 +190,7 @@ ssize_t archive_read_data_into_fd(struct archive *, int fd);
#define ARCHIVE_EXTRACT_PERM (2) /* Default: restore perm only for reg file*/
#define ARCHIVE_EXTRACT_TIME (4) /* Default: mod time not restored */
#define ARCHIVE_EXTRACT_NO_OVERWRITE (8) /* Default: Replace files on disk */
#define ARCHIVE_EXTRACT_UNLINK (16) /* Default: don't unlink existing files */
int archive_read_extract(struct archive *, struct archive_entry *,
int flags);

View File

@ -178,6 +178,11 @@ Note that restoring of atime is not currently supported.
.It Cm ARCHIVE_EXTRACT_NO_OVERWRITE
Existing files on disk will not be overwritten.
By default, existing files are unlinked before the new entry is written.
.It Cm ARCHIVE_EXTRACT_UNLINK
Existing files on disk will be unlinked and recreated from scratch.
By default, existing files are truncated and rewritten, but
the file is not recreated.
In particular, the default behavior does not break existing hard links.
.El
.It Fn archive_read_finish
Complete the archive, invoke the close callback, and release