Module Name: src Committed By: mlelstv Date: Mon Jan 6 07:56:47 UTC 2014
Modified Files: src/external/bsd/nvi/dist/common: screen.c Log Message: screen_end can be called multiple times for the same screen. Work around segfault in TAILQ_REMOVE by abusing the tqe_prev pointer as a flag that identifies an already removed node. This should really be solved by calling screen_end only once or by keeping state explicitely in the screen structure. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/common/screen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/nvi/dist/common/screen.c diff -u src/external/bsd/nvi/dist/common/screen.c:1.6 src/external/bsd/nvi/dist/common/screen.c:1.7 --- src/external/bsd/nvi/dist/common/screen.c:1.6 Sun Dec 1 21:48:33 2013 +++ src/external/bsd/nvi/dist/common/screen.c Mon Jan 6 07:56:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.6 2013/12/01 21:48:33 christos Exp $ */ +/* $NetBSD: screen.c,v 1.7 2014/01/06 07:56:47 mlelstv Exp $ */ /*- * Copyright (c) 1993, 1994 * The Regents of the University of California. All rights reserved. @@ -139,9 +139,14 @@ screen_end1(SCR *sp, int init) * * If a created screen failed during initialization, it may not * be linked into the chain. + * + * XXX screen_end can be called multiple times, abuse the tqe_prev pointer + * to signal wether the tailq node is on-list. */ - if (init) + if (init && sp->q.tqe_prev) { TAILQ_REMOVE(&sp->wp->scrq, sp, q); + sp->q.tqe_prev = NULL; + } /* The screen is no longer real. */ F_CLR(sp, SC_SCR_EX | SC_SCR_VI);