mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
upstream: clean up properly when stopping the progress meter,
even if backgrounded and unable to output. Avoids reading free'd memory in a subsequent progress meter invocation if the right (wrong) sequence of backgrounding and forgroundings happened. Anthropic ANT-2026-4MDN97DH OpenBSD-Commit-ID: 40cc051b556697088851ec492bca2c00e1eac91e
This commit is contained in:
1 parent
d3bdf031d1
commit
0630d978f1
1 file changed
+14
-8
+14
-8
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: progressmeter.c,v 1.57 2026/03/29 01:08:13 djm Exp $ */
|
||||
/* $OpenBSD: progressmeter.c,v 1.58 2026/10/30 01:26:02 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Nils Nordman. All rights reserved.
|
||||
*
|
||||
@@ -269,15 +269,21 @@ stop_progress_meter(void)
|
||||
{
|
||||
alarm(0);
|
||||
|
||||
if (!can_output())
|
||||
return;
|
||||
if (can_output()) {
|
||||
/* Ensure we complete the progress */
|
||||
if (cur_pos != end_pos)
|
||||
refresh_progress_meter(1);
|
||||
atomicio(vwrite, STDOUT_FILENO, "\n", 1);
|
||||
}
|
||||
|
||||
/* Ensure we complete the progress */
|
||||
if (cur_pos != end_pos)
|
||||
refresh_progress_meter(1);
|
||||
|
||||
atomicio(vwrite, STDOUT_FILENO, "\n", 1);
|
||||
/*
|
||||
* Always forget the caller's file name and counter, even when we
|
||||
* are not in the foreground and could not print; they don't outlive
|
||||
* the transfer and must not be used by a later refresh.
|
||||
*/
|
||||
file = NULL;
|
||||
counter = NULL;
|
||||
alarm_fired = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in new issue
Block a user