]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Simplify code.
authorBruno Haible <bruno@clisp.org>
Tue, 18 Feb 2003 13:25:19 +0000 (13:25 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:11 +0000 (12:10 +0200)
gettext-tools/lib/ChangeLog
gettext-tools/lib/copy-file.c

index e509d4198887e7ed903a3a74c334533b01ba8cc2..a8085f3e70a401fb051fd071079facac3cf2c38f 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 1d924645b1a1ef96b4e1cbcbc9bba32adb227856..84b07ac8623f3f3e855d9519414491b9541b25bf 100644 (file)
@@ -1,5 +1,5 @@
 /* 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
@@ -41,6 +41,7 @@
 #endif
 
 #include "error.h"
+#include "safe-read.h"
 #include "full-write.h"
 #include "binary-io.h"
 #include "exit.h"
@@ -73,15 +74,9 @@ copy_file (const char *src_filename, const char *dest_filename)
   /* 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;