From 17ecedd391d8bdb019c949a18d4a09895b1302dd Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Mon, 29 Apr 2002 17:12:00 +0000 Subject: [PATCH] Fix #1171. --- lib.c | 4 ++-- lib.h | 7 +++++++ protos.h | 5 ----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib.c b/lib.c index 9aa94831..a9dad9de 100644 --- a/lib.c +++ b/lib.c @@ -183,8 +183,8 @@ void mutt_unlink (const char *s) memset (buf, 0, sizeof (buf)); while (sb.st_size > 0) { - fwrite (buf, 1, sizeof (buf), f); - sb.st_size -= sizeof (buf); + fwrite (buf, 1, MIN (sizeof (buf), sb.st_size), f); + sb.st_size -= MIN (sizeof (buf), sb.st_size); } fclose (f); } diff --git a/lib.h b/lib.h index 7b6b3ac8..0b66ddfd 100644 --- a/lib.h +++ b/lib.h @@ -75,11 +75,18 @@ # define MUTT_FORMAT(a) _MUTT_FORMAT_1(a, "s") # define MUTT_FORMAT2(a,b) _MUTT_FORMAT_1(a, b) + # define FREE(x) safe_free((void **)x) # define NONULL(x) x?x:"" # define ISSPACE(c) isspace((unsigned char)c) # define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0 +# undef MAX +# undef MIN +# define MAX(a,b) ((a) < (b) ? (b) : (a)) +# define MIN(a,b) ((a) < (b) ? (a) : (b)) + + #define FOREVER while (1) /* this macro must check for *c == 0 since isspace(0) has unreliable behavior diff --git a/protos.h b/protos.h index 33c8bfd5..25dc1863 100644 --- a/protos.h +++ b/protos.h @@ -25,11 +25,6 @@ #define dprint(N,X) #endif -#undef MAX -#undef MIN -#define MAX(a,b) ((a) < (b) ? (b) : (a)) -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - #define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#') #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0) -- 2.40.0