diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2008-06-12 16:53:13 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2008-06-12 16:53:13 +0000 |
commit | 842ff1c6dbda4468183682655286a3a1c6d4e674 (patch) | |
tree | 1f095ee60956235f1f118df7bd77b94dd158a25d /usr.bin | |
parent | aab483d2ef848dba1fd3812072e455f75c95e4e2 (diff) |
cmdp can be NULL while still in cvs_getopt(), so deal with this
inside of cvs_vlog() since cvs_getopt() might be calling it.
spotted by Jonathan Armani
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/log.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/cvs/log.c b/usr.bin/cvs/log.c index 30b757c8318..cde6f72049d 100644 --- a/usr.bin/cvs/log.c +++ b/usr.bin/cvs/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.44 2008/06/11 01:55:05 joris Exp $ */ +/* $OpenBSD: log.c,v 1.45 2008/06/12 16:53:12 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -61,6 +61,7 @@ cvs_vlog(u_int level, const char *fmt, va_list vap) { int ecp; FILE *out; + char *cmdname; if (cvs_trace != 1 && level == LP_TRACE) return; @@ -86,6 +87,8 @@ cvs_vlog(u_int level, const char *fmt, va_list vap) putc(' ', out); } + cmdname = (cmdp != NULL) ? cmdp->cmd_name : __progname; + /* The cvs program appends the command name to the program name */ if (level == LP_TRACE) { if (cvs_server_active) @@ -98,9 +101,9 @@ cvs_vlog(u_int level, const char *fmt, va_list vap) putc(' ', out); if (level == LP_ABORT) (void)fprintf(out, - "[%s aborted]", cmdp->cmd_name); + "[%s aborted]", cmdname); else - (void)fputs(cmdp->cmd_name, out); + (void)fputs(cmdname, out); (void)fputs(": ", out); } |