From: David Lawrence Ramsey Date: Thu, 12 Jul 2007 03:12:31 +0000 (+0000) Subject: in copy_file(), assert that inn and out don't both point to the same X-Git-Tag: v2.0.7~72 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bc243b0a3f2ab8905ee2fffe9a9ea45352ef12d4;p=nano.git 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/branches/nano_2_0_branch/nano@4132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index df25a170..ff9a118b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ CVS code - needle/rev_start is blank. (DLR) - Return char* instead of const char*. (DLR) - Simplify and rewrite to use strncasecmp(). (DLR) +- files.c: + copy_file() + - Assert that inn and out don't both point to the same file. + (DLR) - prompt.c: do_yesno_prompt() - Remove redundant check for NO_HELP's being FALSE. (DLR) 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);