aboutsummaryrefslogtreecommitdiff
path: root/src/diskio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diskio.c')
-rw-r--r--src/diskio.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/diskio.c b/src/diskio.c
index 1760a88..46526d0 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -110,3 +110,3 @@ create_hierarchy (char *dir, size_t baselen)
/* Create a directory BASE/NAME (with eventual intermediate directories in
- NAME). Use UID and GID as owner ids.
+ NAME).
Do nothing if dry_run_mode is set. */
@@ -374,2 +374,4 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
{
+ int rc = 0;
+
switch (archive->type)
@@ -380,3 +382,6 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
case archive_directory:
- return backup_file (dst_file, dst_dir, file, archive, reldir);
+ if (backup_file (dst_file, dst_dir, file, archive, reldir))
+ return 1;
+ UPDATE_STATS (STAT_ARCHIVES);
+ break;
@@ -385,4 +390,7 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
return 1;
+ UPDATE_STATS (STAT_ARCHIVES);
+ break;
}
- if (!dry_run_mode && unlink (dst_file))
+
+ if (!dry_run_mode && unlink (dst_file) && errno != ENOENT)
{
@@ -396,4 +404,4 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
/* Move the part FILE_ID of the triplet TRP between the directories in
- DPAIR. RELDIR gives relative directory (i.e. the directory part of
- the file name) for backup purposes.
+ TRP->SPOOL. TRP->RELATIVE_DIR gives relative directory (i.e. the
+ directory part of the file name) for backup purposes.
@@ -401,4 +409,3 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
int
-dir_move_file (struct file_triplet *trp, const struct spool *spool,
- enum file_type file_id, const char *reldir)
+dir_move_file (struct file_triplet *trp, enum file_type file_id)
{
@@ -406,3 +413,4 @@ dir_move_file (struct file_triplet *trp, const struct spool *spool,
int rc = 0;
- char *dst_dir = create_directory (spool->dest_dir, reldir);
+ const struct spool *spool = trp->spool;
+ char *dst_dir = create_directory (spool->dest_dir, trp->relative_dir);
@@ -418,3 +426,3 @@ dir_move_file (struct file_triplet *trp, const struct spool *spool,
rc = do_archive_file (dst_file, dst_dir, trp->file[file_id].name,
- &spool->archive, reldir);
+ &spool->archive, trp->relative_dir);
@@ -435,4 +443,3 @@ dir_move_file (struct file_triplet *trp, const struct spool *spool,
int
-archive_single_file (struct file_triplet *trp, const struct spool *spool,
- const char *file_name, const char *reldir,
+archive_single_file (struct file_triplet *trp, const char *file_name,
int noentok)
@@ -441,3 +448,4 @@ archive_single_file (struct file_triplet *trp, const struct spool *spool,
int rc = 0;
- char *dst_dir = create_directory (spool->dest_dir, reldir);
+ const struct spool *spool = trp->spool;
+ char *dst_dir = create_directory (spool->dest_dir, trp->relative_dir);
@@ -461,5 +469,3 @@ archive_single_file (struct file_triplet *trp, const struct spool *spool,
rc = do_archive_file (dst_file, dst_dir, file_name, &spool->archive,
- reldir);
- if (rc == 0)
- UPDATE_STATS (STAT_ARCHIVES);
+ trp->relative_dir);
}
@@ -504,4 +510,3 @@ make_signame (const char *file_name)
int
-dir_archive_file (struct file_triplet *trp, const struct spool *spool,
- const char *reldir, const char *file_name)
+dir_archive_file (struct file_triplet *trp, const char *file_name)
{
@@ -510,6 +515,6 @@ dir_archive_file (struct file_triplet *trp, const struct spool *spool,
- rc = archive_single_file (trp, spool, file_name, reldir, 0);
+ rc = archive_single_file (trp, file_name, 0);
if (rc == 0 && archive_signatures && (signame = make_signame (file_name)))
{
- rc = archive_single_file (trp, spool, signame, reldir, 1);
+ rc = archive_single_file (trp, signame, 1);
free (signame);
@@ -520,3 +525,3 @@ dir_archive_file (struct file_triplet *trp, const struct spool *spool,
/* Create a symbolic link from WANTED_SRC to WANTED_DST in the subdirectory
- RELDIR of DPAIR->dest_dir. Get ownership information from TRP.
+ TRP->relative_dir of SPOOL->dest_dir.
@@ -524,4 +529,3 @@ dir_archive_file (struct file_triplet *trp, const struct spool *spool,
int
-dir_symlink_file (struct file_triplet *trp, const struct spool *spool,
- const char *reldir,
+dir_symlink_file (struct file_triplet *trp,
const char *wanted_src, const char *wanted_dst)
@@ -530,3 +534,4 @@ dir_symlink_file (struct file_triplet *trp, const struct spool *spool,
struct saved_cwd cwd;
- char *dst_dir = create_directory (spool->dest_dir, reldir);
+ const struct spool *spool = trp->spool;
+ char *dst_dir = create_directory (spool->dest_dir, trp->relative_dir);
char *src, *dst;
@@ -676,5 +681,3 @@ do_rmsymlink_file (const char *dst_file, int noentok)
-/* Remove the symbolic link DPAIR->dest_dir/RELDIR/FILE_NAME
-
- Get ownership information from TRP.
+/* Remove the symbolic link TRP->spool->dest_dir/TRP->relative_dir/FILE_NAME
@@ -682,4 +685,3 @@ do_rmsymlink_file (const char *dst_file, int noentok)
int
-dir_rmsymlink_file (struct file_triplet *trp, const struct spool *spool,
- const char *reldir, const char *file_name)
+dir_rmsymlink_file (struct file_triplet *trp, const char *file_name)
{
@@ -688,3 +690,4 @@ dir_rmsymlink_file (struct file_triplet *trp, const struct spool *spool,
char *signame;
- char *dst_dir = create_directory (spool->dest_dir, reldir);
+ const struct spool *spool = trp->spool;
+ char *dst_dir = create_directory (spool->dest_dir, trp->relative_dir);

Return to:

Send suggestions and report system problems to the System administrator.