Hi,
Reduce scope of a few variables. While here, remove an extraneous
space.
Regards,
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index a2f480c3393..3e2f94e4fa4 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -55,10 +55,7 @@ copy_file(FTSENT *entp, int exists)
static char *buf;
static char *zeroes;
struct stat to_stat, *fs;
- int from_fd, rcount, rval, to_fd, wcount;
-#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
- char *p;
-#endif
+ int from_fd, rval, to_fd;
if (!buf) {
buf = malloc(MAXBSIZE);
@@ -96,7 +93,7 @@ copy_file(FTSENT *entp, int exists)
if (!copy_overwrite()) {
(void)close(from_fd);
return 2;
- }
+ }
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
} else
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
@@ -118,6 +115,7 @@ copy_file(FTSENT *entp, int exists)
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
/* XXX broken for 0-size mmap */
if (fs->st_size <= 8 * 1048576) {
+ char *p;
if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
MAP_FILE|MAP_SHARED, from_fd, (off_t)0)) ==
MAP_FAILED) {
warn("mmap: %s", entp->fts_path);
@@ -138,6 +136,7 @@ copy_file(FTSENT *entp, int exists)
#endif
{
int skipholes = 0;
+ int rcount, wcount;
struct stat tosb;
if (!fstat(to_fd, &tosb) && S_ISREG(tosb.st_mode))
skipholes = 1;
@@ -255,9 +254,8 @@ copy_special(struct stat *from_stat, int exists)
int
copy_overwrite(void)
{
- int ch, checkch;
-
if (iflag) {
+ int ch, checkch;
(void)fprintf(stderr, "overwrite %s? ", to.p_path);
checkch = ch = getchar();
while (ch != '\n' && ch != EOF)
--
Jerome Pinot