diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2017-11-10 18:31:37 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2017-11-10 18:31:37 +0000 |
commit | d7f38ada2584562daccb9dbf6460e0a84a84dd2e (patch) | |
tree | bab10793695c556f256860110aa8affd248d46d0 /usr.bin | |
parent | a32c71c9762a10989f7f8ab79d7529ba5c6b94f5 (diff) |
When tracing is compiled in make sure it flushes its content to disk as
soon as the TRACE function is called. This helps while debugging crashes.
Noticed and annoyed by while debugging the SIGTERM crash I just submitted.
OK millert@ and tb@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/vi/common/main.c | 3 | ||||
-rw-r--r-- | usr.bin/vi/common/util.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c index ccff821ca35..005973728a8 100644 --- a/usr.bin/vi/common/main.c +++ b/usr.bin/vi/common/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.40 2017/07/03 07:01:14 bentley Exp $ */ +/* $OpenBSD: main.c,v 1.41 2017/11/10 18:31:36 martijn Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -188,6 +188,7 @@ editor(GS *gp, int argc, char *argv[]) } (void)fprintf(gp->tracefp, "\n===\ntrace: open %s\n", optarg); + fflush(gp->tracefp); break; #endif case 't': /* Tag. */ diff --git a/usr.bin/vi/common/util.c b/usr.bin/vi/common/util.c index f64bde0a3d5..1ed7f6e13d0 100644 --- a/usr.bin/vi/common/util.c +++ b/usr.bin/vi/common/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.15 2016/05/27 09:18:11 martijn Exp $ */ +/* $OpenBSD: util.c,v 1.16 2017/11/10 18:31:36 martijn Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -174,6 +174,7 @@ TRACE(SCR *sp, const char *fmt, ...) return; va_start(ap, fmt); (void)vfprintf(tfp, fmt, ap); + fflush(tfp); va_end(ap); (void)fflush(tfp); |