Skip to content

Commit 506a989

Browse files
committed
Make HISTCONTROL=ignoredups work again (broken by misordering of
operations during recent code refactoring). Per bug #2840 from Ned Crigler.
1 parent 57f1630 commit 506a989

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/bin/psql/input.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.60 2006/10/04 00:30:06 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.61 2006/12/24 19:14:28 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -111,6 +111,12 @@ pg_send_history(PQExpBuffer history_buf)
111111
static char *prev_hist = NULL;
112112

113113
char *s = history_buf->data;
114+
int i;
115+
116+
/* Trim any trailing \n's (OK to scribble on history_buf) */
117+
for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--)
118+
;
119+
s[i + 1] = '\0';
114120

115121
if (useHistory && s[0])
116122
{
@@ -123,12 +129,6 @@ pg_send_history(PQExpBuffer history_buf)
123129
}
124130
else
125131
{
126-
int i;
127-
128-
/* Trim any trailing \n's (OK to scribble on history_buf) */
129-
for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--)
130-
;
131-
s[i + 1] = '\0';
132132
/* Save each previous line for ignoredups processing */
133133
if (prev_hist)
134134
free(prev_hist);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy