Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita9f37f1

Browse files
committed
Fixed bug with repeated \e in psql (failed to clear buffers correctly)
1 parent39f69bc commita9f37f1

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

‎src/bin/psql/command.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.25 2000/03/18 22:48:29 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.26 2000/03/27 21:11:37 petere Exp $
77
*/
88
#include"postgres.h"
99
#include"command.h"
@@ -1442,21 +1442,16 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
14421442
{
14431443
/* read file back in */
14441444
charline[1024];
1445-
size_tresult;
14461445

14471446
resetPQExpBuffer(query_buf);
1448-
do
1449-
{
1450-
result=fread(line,1,1024,stream);
1451-
if (ferror(stream))
1452-
{
1453-
psql_error("%s: %s\n",fname,strerror(errno));
1454-
error= true;
1455-
break;
1456-
}
1457-
appendBinaryPQExpBuffer(query_buf,line,result);
1458-
}while (!feof(stream));
1459-
appendPQExpBufferChar(query_buf,'\0');
1447+
while (fgets(line,1024,stream))
1448+
appendPQExpBufferStr(query_buf,line);
1449+
1450+
if (ferror(stream))
1451+
{
1452+
psql_error("%s: %s\n",fname,strerror(errno));
1453+
error= true;
1454+
}
14601455

14611456
fclose(stream);
14621457
}
@@ -1471,6 +1466,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
14711466
}
14721467
}
14731468
}
1469+
14741470
return !error;
14751471
}
14761472

‎src/bin/psql/mainloop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.26 2000/03/18 18:03:11 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.27 2000/03/27 21:11:37 petere Exp $
77
*/
88
#include"postgres.h"
99
#include"mainloop.h"
@@ -481,7 +481,7 @@ MainLoop(FILE *source)
481481

482482

483483
/* Put the rest of the line in the query buffer. */
484-
if (line[query_start+strspn(line+query_start," \t")]!='\0')
484+
if (line[query_start+strspn(line+query_start," \t\n")]!='\0')
485485
{
486486
if (query_buf->len>0)
487487
appendPQExpBufferChar(query_buf,'\n');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp