From 8ce8833c379fd25b247facee9ee21cecb4e0160e Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Mon, 4 Mar 2002 13:52:39 +0000 Subject: [PATCH] * file.c (copy_file_file): Chmod destination only if ctx->preserve is on. Eliminate gotos. --- src/ChangeLog | 5 +++++ src/file.c | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 34e46ad15..506b01841 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-03-04 Andrew V. Samoilov + + * file.c (copy_file_file): Chmod destination only if + ctx->preserve is on. Eliminate gotos. + 2002-03-01 Andrew V. Samoilov * Makefile.am (mc.hlp.ru): New rule to compile translated diff --git a/src/file.c b/src/file.c index c1ea263c2..cf4c82b29 100644 --- a/src/file.c +++ b/src/file.c @@ -489,12 +489,11 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over mc_refresh (); - retry_dst_stat: - if (mc_stat (dst_path, &sb2) == 0){ + while (mc_stat (dst_path, &sb2) == 0){ if (S_ISDIR (sb2.st_mode)){ return_status = file_error (_(" Cannot overwrite directory \"%s\" \n %s "), dst_path); if (return_status == FILE_RETRY) - goto retry_dst_stat; + continue; return return_status; } dst_exists = 1; @@ -791,16 +790,17 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over * .ado: according to the XPG4 standard, the file must be closed before * chmod can be invoked */ - retry_dst_chmod: - if (!appending && mc_chmod (dst_path, src_mode & ctx->umask_kill)){ - temp_status = file_error (_(" Cannot chmod target file \"%s\" \n %s "), dst_path); - if (temp_status == FILE_RETRY) - goto retry_dst_chmod; - return_status = temp_status; - } - - if (!appending && ctx->preserve) + if (!appending && ctx->preserve){ + while (mc_chmod (dst_path, src_mode & ctx->umask_kill)){ + temp_status = file_error ( + _(" Cannot chmod target file \"%s\" \n %s "), dst_path); + if (temp_status != FILE_RETRY){ + return_status = temp_status; + break; + } + } mc_utime (dst_path, &utb); + } } if (return_status == FILE_CONT)