Hi,

Noticed a regression with vi and recent changes to timespec
data types.

To reproduce, run vi without a file name to edit. Try save buffer
via ":w" and you'll be presented by following message:

file modified more recently than this this copy; use ! to override

Patch below fixes this.

Hope this is acceptable.

Thanks,
--patrick

Index: common/exf.c
===================================================================
RCS file: /cvs/obsd/src/usr.bin/vi/common/exf.c,v
retrieving revision 1.36
diff -u -p -u -p -r1.36 exf.c
--- common/exf.c        24 Apr 2015 21:48:31 -0000      1.36
+++ common/exf.c        10 Jun 2015 03:55:58 -0000
@@ -211,7 +211,10 @@ file_init(SCR *sp, FREF *frp, char *rcv_
                if (!LF_ISSET(FS_OPENERR))
                        F_SET(frp, FR_NEWFILE);
 
-               (void)clock_gettime(CLOCK_REALTIME, &ep->mtim);
+               if (stat(tname, &sb))
+                       (void)clock_gettime(CLOCK_REALTIME, &ep->mtim);
+               else
+                       ep->mtim = sb.st_mtim;
        } else {
                /*
                 * XXX

Reply via email to