aboutsummaryrefslogtreecommitdiff
path: root/src/diskio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diskio.c')
-rw-r--r--src/diskio.c90
1 files changed, 46 insertions, 44 deletions
diff --git a/src/diskio.c b/src/diskio.c
index 2604c67..69a3cbe 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -70,14 +70,14 @@ create_hierarchy (char *dir, size_t baselen, uid_t uid, gid_t gid)
{
if (!S_ISDIR (st.st_mode))
{
- logmsg (LOG_ERR, "component %s is not a directory", dir);
+ logmsg (LOG_ERR, _("component %s is not a directory"), dir);
return 1;
}
return 0;
}
else if (errno != ENOENT)
{
- logmsg (LOG_ERR, "cannot stat file %s: %s", dir, strerror (errno));
+ logmsg (LOG_ERR, _("cannot stat file %s: %s"), dir, strerror (errno));
return 1;
}
@@ -86,7 +86,7 @@ create_hierarchy (char *dir, size_t baselen, uid_t uid, gid_t gid)
{
if (p - dir + 1 < baselen)
{
- logmsg (LOG_ERR, "base directory %s does not exist", dir);
+ logmsg (LOG_ERR, _("base directory %s does not exist"), dir);
return 1;
}
*p = 0;
@@ -99,13 +99,13 @@ create_hierarchy (char *dir, size_t baselen, uid_t uid, gid_t gid)
*p = '/';
if (mkdir (dir, MKDIR_PERMISSIONS))
{
- logmsg (LOG_ERR, "cannot create directory %s: %s",
+ logmsg (LOG_ERR, _("cannot create directory %s: %s"),
dir, strerror (errno));
rc = 1;
}
if (chown (dir, uid, gid))
{
- logmsg (LOG_NOTICE, "cannot change ownership of %s: %s",
+ logmsg (LOG_NOTICE, _("cannot change ownership of %s: %s"),
dir, strerror (errno));
}
}
@@ -152,14 +152,14 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
if (in_fd == -1)
{
- logmsg (LOG_ERR, "cannot open source file %s for reading: %s",
+ logmsg (LOG_ERR, _("cannot open source file %s for reading: %s"),
file, strerror (errno));
return 1;
}
if (fstat (in_fd, &st))
{
- logmsg (LOG_ERR, "cannot stat source file %s: %s",
+ logmsg (LOG_ERR, _("cannot stat source file %s: %s"),
file, strerror (errno));
close (in_fd);
return 1;
@@ -168,7 +168,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
out_fd = creat (dst_file, CREAT_PERMISSIONS);
if (out_fd == -1)
{
- logmsg (LOG_ERR, "cannot create destination file %s: %s",
+ logmsg (LOG_ERR, _("cannot create destination file %s: %s"),
file, strerror (errno));
close (in_fd);
return 1;
@@ -193,7 +193,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
rdbytes = read (in_fd, buf, rest);
if (rdbytes == -1)
{
- logmsg (LOG_ERR, "unexpected error reading %s: %s",
+ logmsg (LOG_ERR, _("unexpected error reading %s: %s"),
file, strerror (errno));
rc = 1;
break;
@@ -201,14 +201,14 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
rest = write (out_fd, buf, rdbytes);
if (rest == -1)
{
- logmsg (LOG_ERR, "unexpected error writing to %s: %s",
+ logmsg (LOG_ERR, _("unexpected error writing to %s: %s"),
dst_file, strerror (errno));
rc = 1;
break;
}
else if (rest != rdbytes)
{
- logmsg (LOG_ERR, "short write on %s", dst_file);
+ logmsg (LOG_ERR, _("short write on %s"), dst_file);
rc = 1;
}
fsize -= rdbytes;
@@ -236,19 +236,19 @@ do_move_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
{
if (copy_file (file, dst_file, uid, gid))
{
- logmsg (LOG_CRIT, "cannot copy %s to %s: %s",
+ logmsg (LOG_CRIT, _("cannot copy %s to %s: %s"),
file, dst_file, strerror (errno));
rc = 1;
}
else if (unlink (file))
{
- logmsg (LOG_ERR, "cannot unlink %s: %s",
+ logmsg (LOG_ERR, _("cannot unlink %s: %s"),
file, strerror (errno));
}
}
else
{
- logmsg (LOG_CRIT, "cannot move %s to %s: %s",
+ logmsg (LOG_CRIT, _("cannot move %s to %s: %s"),
file, dst_file, strerror (errno));
rc = 1;
}
@@ -264,7 +264,7 @@ tar_append_file (const char *archive, const char *file)
const char *argv[6];
if (debug_level)
- logmsg (LOG_DEBUG, "tarring %s to %s", file, archive);
+ logmsg (LOG_DEBUG, _("tarring %s to %s"), file, archive);
if (dry_run_mode)
{
UPDATE_STATS (STAT_ARCHIVES);
@@ -286,7 +286,7 @@ tar_append_file (const char *archive, const char *file)
case exec_fail:
case exec_error:
- logmsg (LOG_ERR, "cannot archive %s", file);
+ logmsg (LOG_ERR, _("cannot archive %s"), file);
break;
}
@@ -325,11 +325,12 @@ backup_file (const char *dst_file, const char *dst_dir, const char *file,
if (archive->backup_type == no_backups)
{
if (debug_level)
- logmsg (LOG_DEBUG, "removing previous archive file `%s'",
+ logmsg (LOG_DEBUG, _("removing previous archive file `%s'"),
file_name);
if (!dry_run_mode && unlink (file_name))
{
- logmsg (LOG_ERR, "cannot unlink previous archive file `%s': %s",
+ logmsg (LOG_ERR,
+ _("cannot unlink previous archive file `%s': %s"),
file_name, strerror (errno));
free (file_name);
free (adir);
@@ -341,14 +342,15 @@ backup_file (const char *dst_file, const char *dst_dir, const char *file,
char *archive_file_name =
find_backup_file_name (file_name, archive->backup_type);
if (debug_level)
- logmsg (LOG_DEBUG, "backing up previous archive file `%s' to `%s'",
+ logmsg (LOG_DEBUG,
+ _("backing up previous archive file `%s' to `%s'"),
file_name, archive_file_name);
if (!dry_run_mode)
{
rc = do_move_file (file_name, archive_file_name, uid, gid);
if (rc)
{
- logmsg (LOG_ERR, "backing `%s' up as `%s' failed: %s",
+ logmsg (LOG_ERR, _("backing `%s' up as `%s' failed: %s"),
file_name, archive_file_name, strerror (errno));
free (archive_file_name);
free (file_name);
@@ -361,12 +363,12 @@ backup_file (const char *dst_file, const char *dst_dir, const char *file,
}
if (debug_level)
- logmsg (LOG_DEBUG, "archiving `%s' to `%s'", dst_file, file_name);
+ logmsg (LOG_DEBUG, _("archiving `%s' to `%s'"), dst_file, file_name);
if (!dry_run_mode)
{
rc = do_move_file (dst_file, file_name, uid, gid);
if (rc)
- logmsg (LOG_ERR, "archiving `%s' as `%s' failed: %s",
+ logmsg (LOG_ERR, _("archiving `%s' as `%s' failed: %s"),
dst_file, file_name, strerror (errno));
}
free (file_name);
@@ -395,7 +397,7 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
}
if (!dry_run_mode && unlink (dst_file))
{
- logmsg (LOG_ERR, "Canot unlink file `%s': %s",
+ logmsg (LOG_ERR, _("canot unlink file `%s': %s"),
dst_file, strerror (errno));
return 1;
}
@@ -421,7 +423,7 @@ dir_move_file (struct file_triplet *trp, struct spool *spool,
dst_file = concat_dir (dst_dir, trp->file[file_id].name, NULL);
if (debug_level)
- logmsg (LOG_DEBUG, "installing %s to %s", trp->file[file_id].name,
+ logmsg (LOG_DEBUG, _("installing %s to %s"), trp->file[file_id].name,
dst_dir);
if (access (dst_file, F_OK) == 0)
@@ -460,7 +462,7 @@ archive_single_file (struct file_triplet *trp, struct spool *spool,
dst_file = safe_file_name (concat_dir (dst_dir, file_name, NULL));
if (!sub_dir_p (dst_file, spool->dest_dir))
{
- logmsg (LOG_ERR, "file to be archived `%s' does not lie under `%s'",
+ logmsg (LOG_ERR, _("file to be archived `%s' does not lie under `%s'"),
dst_file, spool->dest_dir);
free (dst_file);
free (dst_dir);
@@ -470,7 +472,7 @@ archive_single_file (struct file_triplet *trp, struct spool *spool,
if (access (dst_file, F_OK) == 0)
{
if (debug_level)
- logmsg (LOG_DEBUG, "Archiving file `%s'", dst_file);
+ logmsg (LOG_DEBUG, _("archiving file `%s'"), dst_file);
rc = do_archive_file (dst_file, dst_dir, file_name, &spool->archive,
TRIPLET_UID (trp), TRIPLET_GID (trp), reldir);
if (rc == 0)
@@ -479,12 +481,12 @@ archive_single_file (struct file_triplet *trp, struct spool *spool,
else if (errno == ENOENT)
{
if (!noentok)
- logmsg (LOG_NOTICE, "Nothing to archive: file `%s' does not exist",
+ logmsg (LOG_NOTICE, _("nothing to archive: file `%s' does not exist"),
dst_file);
}
else
{
- logmsg (LOG_ERR, "Canot access file `%s': %s",
+ logmsg (LOG_ERR, _("canot access file `%s': %s"),
dst_file, strerror (errno));
rc = 1;
}
@@ -550,7 +552,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
if (save_cwd (&cwd))
{
- logmsg (LOG_ERR, "cannot save current directory: %s",
+ logmsg (LOG_ERR, _("cannot save current directory: %s"),
strerror (errno));
return 1;
}
@@ -558,7 +560,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
src = safe_file_name_alloc (wanted_src);
if (!src || src[0] == '/')
{
- logmsg (LOG_ERR, "symlink source `%s' does not lie under `%s'",
+ logmsg (LOG_ERR, _("symlink source `%s' does not lie under `%s'"),
wanted_src, spool->dest_dir);
free (src);
return 1;
@@ -567,7 +569,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
dst = safe_file_name_alloc (wanted_dst);
if (!dst || dst[0] == '/')
{
- logmsg (LOG_ERR, "symlink destination `%s' does not lie under `%s'",
+ logmsg (LOG_ERR, _("symlink destination `%s' does not lie under `%s'"),
wanted_dst, spool->dest_dir);
free (src);
free (dst);
@@ -575,7 +577,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
}
if (debug_level)
- logmsg (LOG_DEBUG, "symlinking %s to %s in directory %s",
+ logmsg (LOG_DEBUG, _("symlinking %s to %s in directory %s"),
src, dst, dst_dir);
if (!dry_run_mode)
@@ -598,7 +600,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
if (rc == 0)
{
if (chdir (dst_dir))
- logmsg (LOG_ERR, "cannot change to %s: %s",
+ logmsg (LOG_ERR, _("cannot change to %s: %s"),
dst_dir, strerror (errno));
else
{
@@ -609,14 +611,14 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
if (!S_ISLNK (st.st_mode))
{
logmsg (LOG_ERR,
- "file %s exists and is not a symbolic link",
+ _("file %s exists and is not a symbolic link"),
dst);
rc = 1;
}
else if (unlink (dst))
{
logmsg (LOG_ERR,
- "Cannot unlink %s: %s",
+ _("cannot unlink %s: %s"),
dst, strerror (errno));
rc = 1;
}
@@ -624,7 +626,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
else if (errno != ENOENT)
{
logmsg (LOG_ERR,
- "cannot stat file %s: %s",
+ _("cannot stat file %s: %s"),
dst, strerror (errno));
rc = 1;
}
@@ -634,7 +636,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
rc = symlink (src, dst);
if (rc)
logmsg (LOG_ERR,
- "symlinking %s to %s in directory %s failed: %s",
+ _("symlinking %s to %s in directory %s failed: %s"),
src, dst, dst_dir, strerror (errno));
}
}
@@ -643,7 +645,7 @@ dir_symlink_file (struct file_triplet *trp, struct spool *spool,
if (restore_cwd (&cwd))
{
- logmsg (LOG_EMERG, "cannot restore current directory: %s",
+ logmsg (LOG_EMERG, _("cannot restore current directory: %s"),
strerror (errno));
exit (1);
}
@@ -663,26 +665,26 @@ do_rmsymlink_file (const char *dst_file, int noentok)
struct stat st;
if (debug_level)
- logmsg (LOG_DEBUG, "Removing symbolic link %s", dst_file);
+ logmsg (LOG_DEBUG, _("removing symbolic link %s"), dst_file);
if (stat (dst_file, &st))
{
if (errno == ENOENT)
{
if (!noentok)
- logmsg (LOG_NOTICE, "Symlink `%s' does not exist", dst_file);
+ logmsg (LOG_NOTICE, _("symlink `%s' does not exist"), dst_file);
return 0;
}
if (!S_ISLNK (st.st_mode))
{
- logmsg (LOG_ERR, "Refusing to unlink %s: is not a symlink",
+ logmsg (LOG_ERR, _("refusing to unlink %s: is not a symlink"),
dst_file);
return 1;
}
}
if (!dry_run_mode && unlink (dst_file))
{
- logmsg (LOG_ERR, "Cannot unlink %s: %s", dst_file, strerror (errno));
+ logmsg (LOG_ERR, _("cannot unlink %s: %s"), dst_file, strerror (errno));
return 1;
}
UPDATE_STATS (STAT_RMSYMLINKS);
@@ -710,8 +712,8 @@ dir_rmsymlink_file (struct file_triplet *trp, struct spool *spool,
dst_file = safe_file_name (concat_dir (dst_dir, file_name, NULL));
if (!sub_dir_p (dst_file, spool->dest_dir))
{
- logmsg (LOG_ERR, "refusing to remove a symlink `%s' that is not "
- "located under `%s'",
+ logmsg (LOG_ERR, _("refusing to remove a symlink `%s' that is not "
+ "located under `%s'"),
dst_file, spool->dest_dir);
free (dst_file);
free (dst_dir);

Return to:

Send suggestions and report system problems to the System administrator.