mirror of https://github.com/MidnightCommander/mc
(copy_file_file): rename variables.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
18f6b85005
commit
abfadbb27f
|
@ -1488,7 +1488,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
int src_desc, dest_desc = -1;
|
||||
int n_read, n_written;
|
||||
mode_t src_mode = 0; /* The mode of the source file */
|
||||
struct stat sb, sb2;
|
||||
struct stat src_stat, dst_stat;
|
||||
struct utimbuf utb;
|
||||
gboolean dst_exists = FALSE, appending = FALSE;
|
||||
off_t file_size = -1;
|
||||
|
@ -1518,9 +1518,9 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
|
||||
mc_refresh ();
|
||||
|
||||
while (mc_stat (dst_vpath, &sb2) == 0)
|
||||
while (mc_stat (dst_vpath, &dst_stat) == 0)
|
||||
{
|
||||
if (S_ISDIR (sb2.st_mode))
|
||||
if (S_ISDIR (dst_stat.st_mode))
|
||||
{
|
||||
if (ctx->skip_all)
|
||||
return_status = FILE_SKIPALL;
|
||||
|
@ -1539,7 +1539,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
break;
|
||||
}
|
||||
|
||||
while ((*ctx->stat_func) (src_vpath, &sb) != 0)
|
||||
while ((*ctx->stat_func) (src_vpath, &src_stat) != 0)
|
||||
{
|
||||
if (ctx->skip_all)
|
||||
return_status = FILE_SKIPALL;
|
||||
|
@ -1557,7 +1557,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
if (dst_exists)
|
||||
{
|
||||
/* Destination already exists */
|
||||
if (sb.st_dev == sb2.st_dev && sb.st_ino == sb2.st_ino)
|
||||
if (src_stat.st_dev == dst_stat.st_dev && src_stat.st_ino == dst_stat.st_ino)
|
||||
{
|
||||
return_status = warn_same_file (_("\"%s\"\nand\n\"%s\"\nare the same file"),
|
||||
src_path, dst_path);
|
||||
|
@ -1568,7 +1568,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
if (tctx->ask_overwrite)
|
||||
{
|
||||
ctx->do_reget = 0;
|
||||
return_status = query_replace (ctx, dst_path, &sb, &sb2);
|
||||
return_status = query_replace (ctx, dst_path, &src_stat, &dst_stat);
|
||||
if (return_status != FILE_CONT)
|
||||
goto ret_fast;
|
||||
}
|
||||
|
@ -1577,23 +1577,24 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
if (!ctx->do_append)
|
||||
{
|
||||
/* Check the hardlinks */
|
||||
if (!ctx->follow_links && sb.st_nlink > 1 && check_hardlinks (src_vpath, dst_vpath, &sb))
|
||||
if (!ctx->follow_links && src_stat.st_nlink > 1
|
||||
&& check_hardlinks (src_vpath, dst_vpath, &src_stat))
|
||||
{
|
||||
/* We have made a hardlink - no more processing is necessary */
|
||||
return_status = FILE_CONT;
|
||||
goto ret_fast;
|
||||
}
|
||||
|
||||
if (S_ISLNK (sb.st_mode))
|
||||
if (S_ISLNK (src_stat.st_mode))
|
||||
{
|
||||
return_status = make_symlink (ctx, src_path, dst_path);
|
||||
goto ret_fast;
|
||||
}
|
||||
|
||||
if (S_ISCHR (sb.st_mode) || S_ISBLK (sb.st_mode) ||
|
||||
S_ISFIFO (sb.st_mode) || S_ISNAM (sb.st_mode) || S_ISSOCK (sb.st_mode))
|
||||
if (S_ISCHR (src_stat.st_mode) || S_ISBLK (src_stat.st_mode) || S_ISFIFO (src_stat.st_mode)
|
||||
|| S_ISNAM (src_stat.st_mode) || S_ISSOCK (src_stat.st_mode))
|
||||
{
|
||||
while (mc_mknod (dst_vpath, sb.st_mode & ctx->umask_kill, sb.st_rdev) < 0
|
||||
while (mc_mknod (dst_vpath, src_stat.st_mode & ctx->umask_kill, src_stat.st_rdev) < 0
|
||||
&& !ctx->skip_all)
|
||||
{
|
||||
return_status = file_error (_("Cannot create special file \"%s\"\n%s"), dst_path);
|
||||
|
@ -1605,8 +1606,8 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
}
|
||||
/* Success */
|
||||
|
||||
while (ctx->preserve_uidgid && mc_chown (dst_vpath, sb.st_uid, sb.st_gid) != 0
|
||||
&& !ctx->skip_all)
|
||||
while (ctx->preserve_uidgid
|
||||
&& mc_chown (dst_vpath, src_stat.st_uid, src_stat.st_gid) != 0 && !ctx->skip_all)
|
||||
{
|
||||
temp_status = file_error (_("Cannot chown target file \"%s\"\n%s"), dst_path);
|
||||
if (temp_status == FILE_SKIP)
|
||||
|
@ -1620,7 +1621,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
}
|
||||
}
|
||||
|
||||
while (ctx->preserve && mc_chmod (dst_vpath, sb.st_mode & ctx->umask_kill) != 0
|
||||
while (ctx->preserve && mc_chmod (dst_vpath, src_stat.st_mode & ctx->umask_kill) != 0
|
||||
&& !ctx->skip_all)
|
||||
{
|
||||
temp_status = file_error (_("Cannot chmod target file \"%s\"\n%s"), dst_path);
|
||||
|
@ -1665,7 +1666,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
}
|
||||
}
|
||||
|
||||
while (mc_fstat (src_desc, &sb) != 0)
|
||||
while (mc_fstat (src_desc, &src_stat) != 0)
|
||||
{
|
||||
if (ctx->skip_all)
|
||||
return_status = FILE_SKIPALL;
|
||||
|
@ -1681,12 +1682,12 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
goto ret;
|
||||
}
|
||||
|
||||
src_mode = sb.st_mode;
|
||||
src_uid = sb.st_uid;
|
||||
src_gid = sb.st_gid;
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
file_size = sb.st_size;
|
||||
src_mode = src_stat.st_mode;
|
||||
src_uid = src_stat.st_uid;
|
||||
src_gid = src_stat.st_gid;
|
||||
utb.actime = src_stat.st_atime;
|
||||
utb.modtime = src_stat.st_mtime;
|
||||
file_size = src_stat.st_size;
|
||||
|
||||
open_flags = O_WRONLY;
|
||||
if (dst_exists)
|
||||
|
@ -1725,7 +1726,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
ctx->do_append = FALSE;
|
||||
|
||||
/* Find out the optimal buffer size. */
|
||||
while (mc_fstat (dest_desc, &sb) != 0)
|
||||
while (mc_fstat (dest_desc, &dst_stat) != 0)
|
||||
{
|
||||
if (ctx->skip_all)
|
||||
return_status = FILE_SKIPALL;
|
||||
|
@ -1741,7 +1742,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
}
|
||||
|
||||
/* try preallocate space; if fail, try copy anyway */
|
||||
while (vfs_preallocate (dest_desc, file_size, appending ? sb.st_size : 0) != 0)
|
||||
while (vfs_preallocate (dest_desc, file_size, appending ? dst_stat.st_size : 0) != 0)
|
||||
{
|
||||
if (ctx->skip_all)
|
||||
{
|
||||
|
@ -1797,7 +1798,7 @@ copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
|||
|
||||
tv_last_update = tv_transfer_start;
|
||||
|
||||
bufsize = io_blksize (sb);
|
||||
bufsize = io_blksize (dst_stat);
|
||||
buf = g_malloc (bufsize);
|
||||
|
||||
while (TRUE)
|
||||
|
|
Loading…
Reference in New Issue