Module Name: src Committed By: christos Date: Sun Nov 14 19:36:07 UTC 2010
Modified Files: src/bin/sh: show.c Log Message: don't core-dump if we cannot open the trace file. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/bin/sh/show.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/show.c diff -u src/bin/sh/show.c:1.26 src/bin/sh/show.c:1.27 --- src/bin/sh/show.c:1.26 Fri Nov 14 05:46:13 2003 +++ src/bin/sh/show.c Sun Nov 14 14:36:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: show.c,v 1.26 2003/11/14 10:46:13 dsl Exp $ */ +/* $NetBSD: show.c,v 1.27 2010/11/14 19:36:07 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: show.c,v 1.26 2003/11/14 10:46:13 dsl Exp $"); +__RCSID("$NetBSD: show.c,v 1.27 2010/11/14 19:36:07 christos Exp $"); #endif #endif /* not lint */ @@ -273,7 +273,7 @@ void trputc(int c) { - if (debug != 1) + if (debug != 1 || !tracefile) return; putc(c, tracefile); } @@ -285,7 +285,7 @@ #ifdef DEBUG va_list va; - if (debug != 1) + if (debug != 1 || !tracefile) return; va_start(va, fmt); (void) vfprintf(tracefile, fmt, va); @@ -297,7 +297,7 @@ tracev(const char *fmt, va_list va) { #ifdef DEBUG - if (debug != 1) + if (debug != 1 || !tracefile) return; (void) vfprintf(tracefile, fmt, va); #endif @@ -308,7 +308,7 @@ void trputs(const char *s) { - if (debug != 1) + if (debug != 1 || !tracefile) return; fputs(s, tracefile); } @@ -320,7 +320,7 @@ char *p; char c; - if (debug != 1) + if (debug != 1 || !tracefile) return; putc('"', tracefile); for (p = s ; *p ; p++) { @@ -359,7 +359,7 @@ trargs(char **ap) { #ifdef DEBUG - if (debug != 1) + if (debug != 1 || !tracefile) return; while (*ap) { trstring(*ap++); @@ -405,6 +405,7 @@ if (tracefile) { if (!freopen(s, "a", tracefile)) { fprintf(stderr, "Can't re-open %s\n", s); + tracefile = NULL; debug = 0; return; }