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

Commit61d7511

Browse files
committed
Fix a couple of places that would loop forever if attempts to read a stdio file
set ferror() but never set feof(). This is known to be the case for recentglibc when trying to read a directory as a file, and might be true for otherplatforms/cases too. Per report from Ed L. (There is more that we ought todo about his report, but this is one easily identifiable issue.)
1 parenteb1c3b5 commit61d7511

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎src/backend/libpq/hba.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.199 2010/03/01 16:02:01 mha Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.200 2010/03/03 20:31:08 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -404,7 +404,7 @@ tokenize_file(const char *filename, FILE *file,
404404

405405
*lines=*line_nums=NIL;
406406

407-
while (!feof(file))
407+
while (!feof(file)&& !ferror(file))
408408
{
409409
buf=next_token_expand(filename,file);
410410

‎src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.388 2010/02/26 02:01:32 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.389 2010/03/03 20:31:09 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -4394,7 +4394,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
43944394
if (fp==NULL)
43954395
returnNULL;
43964396

4397-
while (!feof(fp))
4397+
while (!feof(fp)&& !ferror(fp))
43984398
{
43994399
char*t=buf,
44004400
*ret;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp