--- mutt-1.2.5i/lib.c	Tue May 16 10:23:12 2000
+++ mutt-1.2.5i-grvs/lib.c	Sat Sep 22 01:21:00 2001
@@ -374,11 +374,19 @@ FILE *safe_fopen (const char *path, cons
     flags |= O_NOFOLLOW;
 #endif
 
-    if (mode[1] == '+')
+    if (strchr(mode, '+') != NULL)
       flags |= O_RDWR;
     else
       flags |= O_WRONLY;
 
+    /* Check if binary mode is specified */
+#ifdef O_BINARY
+    if(strchr(mode, 'b') != NULL)
+    {
+		flags |= O_BINARY;
+	}
+#endif
+
     if ((fd = safe_open (path, flags)) < 0)
       return (NULL);
 
--- mutt-1.2.5i/sendlib.c	Sat May 20 01:39:00 2000
+++ mutt-1.2.5i-grvs/sendlib.c	Fri Sep 21 23:52:08 2001
@@ -482,8 +482,17 @@ int mutt_write_mime_body (BODY *a, FILE 
 #endif /* HAVE_PGP */
 
 
+  /* Open the file to encode in the correct mode */
+  if(mutt_is_text_type (a->type, a->subtype))
+  {
+    fpin = fopen (a->filename, "r");
+  }
+  else
+  {
+    fpin = fopen (a->filename, "rb");
+  }
 
-  if ((fpin = fopen (a->filename, "r")) == NULL)
+  if (fpin == NULL)
   {
     dprint(1,(debugfile, "write_mime_body: %s no longer exists!\n",a->filename));
     mutt_error (_("%s no longer exists!"), a->filename);
--- mutt-1.2.5i/configure.in	Sun Feb  4 16:24:00 2001
+++ mutt-1.2.5i-grvs/configure.in	Sat Sep 22 00:57:04 2001
@@ -204,9 +204,9 @@ AC_CHECK_FUNCS(setrlimit)
 AC_TYPE_SIGNAL
 
 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
-AC_EGREP_HEADER(sig_atomic_t,signal.h,dnl
-  [ ac_cv_type_sig_atomic_t=yes; AC_MSG_RESULT(yes) ],dnl
-  AC_MSG_RESULT(no); AC_CHECK_TYPE(sig_atomic_t, int))
+AC_EGREP_HEADER(sig_atomic_t,signal.h,
+  [ ac_cv_type_sig_atomic_t=yes; AC_MSG_RESULT(yes) ],
+  [ AC_MSG_RESULT(no); AC_CHECK_TYPE(sig_atomic_t, int) ])
 
 AC_DECL_SYS_SIGLIST
 
@@ -608,7 +608,6 @@ AC_SUBST(LIBIMAPDEPS)
 MUTT_AM_GNU_GETTEXT
 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/intl"
 
-test "$ac_cv_cygwin" = yes && LIBS="$LIBS /usr/lib/binmode.o"
 test "$ac_cv_cygwin" = yes && DATADIRNAME=share
 
 MUTTLOCALEDIR=$mutt_cv_prefix/$DATADIRNAME/locale

