Make ed(1) warn about modifications if 'r'ead in an empty file and
authormartijn <martijn@openbsd.org>
Mon, 26 Feb 2018 17:35:08 +0000 (17:35 +0000)
committermartijn <martijn@openbsd.org>
Mon, 26 Feb 2018 17:35:08 +0000 (17:35 +0000)
trying to quit.

Diff from Tim Chase
OK tb@ and millert@

bin/ed/main.c

index 3ddf399..45688d3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: main.c,v 1.60 2017/04/26 21:25:43 naddy Exp $ */
+/*     $OpenBSD: main.c,v 1.61 2018/02/26 17:35:08 martijn Exp $       */
 /*     $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $     */
 
 /* main.c: This file contains the main control and user-interface routines
@@ -723,7 +723,7 @@ exec_command(void)
                if ((addr = read_file(*fnp ? fnp : old_filename,
                    second_addr)) < 0)
                        return ERR;
-               else if (addr && addr != addr_last)
+               else if (addr)
                        modified = 1;
                break;
        case 's':