Module Name: src Committed By: christos Date: Fri Apr 8 20:11:31 UTC 2022
Modified Files: src/lib/libedit: readline.c Log Message: PR/56778: Detlev Casanova: Missing rl_initialize call in rl_copy_text To generate a diff of this commit: cvs rdiff -u -r1.173 -r1.174 src/lib/libedit/readline.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/readline.c diff -u src/lib/libedit/readline.c:1.173 src/lib/libedit/readline.c:1.174 --- src/lib/libedit/readline.c:1.173 Sat Feb 19 12:45:02 2022 +++ src/lib/libedit/readline.c Fri Apr 8 16:11:31 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.173 2022/02/19 17:45:02 christos Exp $ */ +/* $NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.173 2022/02/19 17:45:02 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $"); #endif /* not lint && not SCCSID */ #include <sys/types.h> @@ -2307,10 +2307,15 @@ _rl_update_pos(void) char * rl_copy_text(int from, int to) { - const LineInfo *li = el_line(e); + const LineInfo *li; size_t len; char * out; + if (h == NULL || e == NULL) + rl_initialize(); + + li = el_line(e); + if (from > to) return NULL;