From 3678477e3291f655b33ac8a2bd2641eaa6411c88 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 12 Jul 2007 03:12:31 +0000 Subject: [PATCH] in copy_file(), assert that inn and out don't both point to the same file git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++++ src/files.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index edd8c2ba..ffa42071 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-07-11 David Lawrence Ramsey + + * files.c (copy_file): Assert that inn and out don't both point + to the same file. + 2007-07-10 David Lawrence Ramsey * chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr, diff --git a/src/files.c b/src/files.c index 350c4362..e75f651e 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); -- 2.39.5