From: Jim Meyering Date: Mon, 14 Aug 2000 09:58:25 +0000 (+0000) Subject: (copy_reg): Move declaration of local, `n_read', into X-Git-Tag: FILEUTILS-4_0y~34 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0f8dd3a95412ade3dd0a4efdb917aa3fab623f51;p=thirdparty%2Fcoreutils.git (copy_reg): Move declaration of local, `n_read', into the scope where it's used. (copy_internal): In calling copy_reg, pass not the raw `src_mode', but the possibly-umask-relative mode, `get_dest_mode (x, src_mode)'. --- diff --git a/src/copy.c b/src/copy.c index 712f81f677..ef3ab174ff 100644 --- a/src/copy.c +++ b/src/copy.c @@ -169,7 +169,6 @@ copy_reg (const char *src_path, const char *dst_path, int buf_size; int dest_desc; int source_desc; - int n_read; struct stat sb; char *cp; int *ip; @@ -241,7 +240,7 @@ copy_reg (const char *src_path, const char *dst_path, for (;;) { - n_read = read (source_desc, buf, buf_size); + int n_read = read (source_desc, buf, buf_size); if (n_read < 0) { #ifdef EINTR @@ -815,8 +814,10 @@ copy_internal (const char *src_path, const char *dst_path, { copied_as_regular = 1; /* POSIX says the permission bits of the source file must be - used as the 3rd argument in the open call. */ - if (copy_reg (src_path, dst_path, x->sparse_mode, src_mode)) + used as the 3rd argument in the open call, but that's not consistent + with historical practice. */ + if (copy_reg (src_path, dst_path, x->sparse_mode, + get_dest_mode (x, src_mode))) goto un_backup; } else