+2003-02-18 Bruno Haible <bruno@clisp.org>
+
+ * copy-file.c: Include safe-read.h.
+ (copy_file): Simplify code by using safe_read() instead of read().
+
2003-02-12 Bruno Haible <bruno@clisp.org>
* Makefile.am (EXTRA_DIST): Add ChangeLog.0.
/* Copying of files.
- Copyright (C) 2001-2002 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
#endif
#include "error.h"
+#include "safe-read.h"
#include "full-write.h"
#include "binary-io.h"
#include "exit.h"
/* Copy the file contents. */
for (;;)
{
- ssize_t n_read = read (src_fd, buf, buf_size);
- if (n_read < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- error (EXIT_FAILURE, errno, _("error reading \"%s\""), src_filename);
- }
+ size_t n_read = safe_read (src_fd, buf, buf_size);
+ if (n_read == SAFE_READ_ERROR)
+ error (EXIT_FAILURE, errno, _("error reading \"%s\""), src_filename);
if (n_read == 0)
break;