]> granicus.if.org Git - mutt/commitdiff
Fix #1171.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 29 Apr 2002 17:12:00 +0000 (17:12 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 29 Apr 2002 17:12:00 +0000 (17:12 +0000)
lib.c
lib.h
protos.h

diff --git a/lib.c b/lib.c
index 9aa94831a0a4fdbbce5ee6820ec7c9bd87f206e6..a9dad9ded6730102605cec06012ec1834df7df1d 100644 (file)
--- 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 7b6b3ac8795b4e2fa5a89dd8ea7c24c54bcf479a..0b66ddfd420b12a0663e9bc866b5e62646cd74ec 100644 (file)
--- a/lib.h
+++ b/lib.h
 # 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
index 33c8bfd59f955b542ecab5afd7302e3ec07ddf86..25dc18630c4dd45b93ca443c76fec4655ec51f1b 100644 (file)
--- a/protos.h
+++ b/protos.h
 #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)