summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-31 07:15:14 +0000
committerJim Meyering <jim@meyering.net>2001-08-31 07:15:14 +0000
commitb62d5afd3ff871ebcb028ce13b995da335325b4d (patch)
treeeccba197b348810d3d0ba3af4a0dfb75e7fc360c /src/copy.c
parentab0bba995818d7c385c4965f903a2cc0cc19334a (diff)
downloadcoreutils-b62d5afd3ff871ebcb028ce13b995da335325b4d.tar.xz
Include full-write.h.
(full_write): Remove decl; not needed. (copy_reg): Don't assume read and write size fits in int.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/copy.c b/src/copy.c
index f644b7610..2ad33fcf8 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -33,6 +33,7 @@
#include "copy.h"
#include "cp-hash.h"
#include "dirname.h"
+#include "full-write.h"
#include "path-concat.h"
#include "quote.h"
#include "same.h"
@@ -55,7 +56,6 @@ struct dir_list
dev_t dev;
};
-int full_write ();
int euidaccess ();
int yesno ();
@@ -285,7 +285,7 @@ copy_reg (const char *src_path, const char *dst_path,
for (;;)
{
- int n_read = read (source_desc, buf, buf_size);
+ ssize_t n_read = read (source_desc, buf, buf_size);
if (n_read < 0)
{
#ifdef EINTR
@@ -338,7 +338,7 @@ copy_reg (const char *src_path, const char *dst_path,
}
if (ip == 0)
{
- if (full_write (dest_desc, buf, n_read) < 0)
+ if (full_write (dest_desc, buf, n_read) != n_read)
{
error (0, errno, _("writing %s"), quote (dst_path));
return_val = -1;
@@ -356,12 +356,12 @@ copy_reg (const char *src_path, const char *dst_path,
{
#if HAVE_FTRUNCATE
/* Write a null character and truncate it again. */
- if (full_write (dest_desc, "", 1) < 0
+ if (full_write (dest_desc, "", 1) != 1
|| ftruncate (dest_desc, n_read_total) < 0)
#else
/* Seek backwards one character and write a null. */
if (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
- || full_write (dest_desc, "", 1) < 0)
+ || full_write (dest_desc, "", 1) != 1)
#endif
{
error (0, errno, _("writing %s"), quote (dst_path));