diff --git a/ChangeLog b/ChangeLog index edd8c2bac78f92ae077af72833e4aafa4caecff8..ffa420715bc776a40020848f72a50d0a952d615f 100644 --- 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, diff --git a/src/files.c b/src/files.c index 350c4362f666c4d1e32ab177b8773657fe796f0d..e75f651e967bb84567a892c8ef456a5b72ebdb96 100644 --- a/src/files.c +++ b/src/files.c @@ -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);