]> git.wh0rd.org Git - nano.git/commitdiff
in copy_file(), assert that inn and out don't both point to the same
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Thu, 12 Jul 2007 03:12:31 +0000 (03:12 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Thu, 12 Jul 2007 03:12:31 +0000 (03:12 +0000)
file

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index edd8c2bac78f92ae077af72833e4aafa4caecff8..ffa420715bc776a40020848f72a50d0a952d615f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-11  David Lawrence Ramsey  <pooka109@gmail.com>
+
+       * files.c (copy_file): Assert that inn and out don't both point
+       to the same file.
+
 2007-07-10  David Lawrence Ramsey  <pooka109@gmail.com>
 
        * chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
index 350c4362f666c4d1e32ab177b8773657fe796f0d..e75f651e967bb84567a892c8ef456a5b72ebdb96 100644 (file)
@@ -1234,11 +1234,11 @@ void init_backup_dir(void)
  * on write error. */
 int copy_file(FILE *inn, FILE *out)
 {
+    int retval = 0;
     char buf[BUFSIZ];
     size_t charsread;
-    int retval = 0;
 
-    assert(inn != NULL && out != NULL);
+    assert(inn != NULL && out != NULL && inn != out);
 
     do {
        charsread = fread(buf, sizeof(char), BUFSIZ, inn);