]> granicus.if.org Git - mutt/commitdiff
patch-1.2.bj.ed_mtime.1
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 8 Jun 2000 14:39:07 +0000 (14:39 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 8 Jun 2000 14:39:07 +0000 (14:39 +0000)
send.c

diff --git a/send.c b/send.c
index d5f43a70e3a227da2311cf2580d96e76782dc82b..1ac7bdcfabc9d8e066be8ef5abfe6fe27e432598 100644 (file)
--- a/send.c
+++ b/send.c
@@ -33,6 +33,9 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <dirent.h>
+#include <time.h>
+#include <sys/types.h>
+#include <utime.h>
 
 #ifdef HAVE_PGP
 #include "pgp.h"
@@ -1223,9 +1226,20 @@ ci_send_message (int flags,              /* send mode */
   {
     struct stat st;
     time_t mtime;
+    struct utimbuf utim;
 
     stat (msg->content->filename, &st);
     mtime = st.st_mtime;
+    if (mtime == time (NULL))
+    {
+      /* Decrease the file's modification time by 1 second so we are sure
+       * to find out if the `editor' program changes it in less than 1 second.
+       */
+      mtime -= 1;
+      utim.actime = mtime;
+      utim.modtime = mtime;
+      utime (msg->content->filename, &utim);
+    }
 
     mutt_update_encoding (msg->content);