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

Commit068bf65

Browse files
committed
Fix initdb to not generate misleading error messages when postgres.bki
or other share-directory files are inaccessible for some reason otherthan not existing. Inspired by trouble report from Simon Kinsella.
1 parent61f621b commit068bf65

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.129 2007/01/20 17:04:58 momjian Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.130 2007/01/31 18:52:49 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1041,10 +1041,26 @@ check_input(char *path)
10411041
{
10421042
structstatstatbuf;
10431043

1044-
if (stat(path,&statbuf)!=0|| !S_ISREG(statbuf.st_mode))
1044+
if (stat(path,&statbuf)!=0)
1045+
{
1046+
if (errno==ENOENT)
1047+
fprintf(stderr,
1048+
_("%s: file \"%s\" does not exist\n"
1049+
"This means you have a corrupted installation or identified\n"
1050+
"the wrong directory with the invocation option -L.\n"),
1051+
progname,path);
1052+
else
1053+
fprintf(stderr,
1054+
_("%s: could not access file \"%s\": %s\n"
1055+
"This may mean you have a corrupted installation or identified\n"
1056+
"the wrong directory with the invocation option -L.\n"),
1057+
progname,path,strerror(errno));
1058+
exit(1);
1059+
}
1060+
if (!S_ISREG(statbuf.st_mode))
10451061
{
10461062
fprintf(stderr,
1047-
_("%s: file \"%s\"does notexist\n"
1063+
_("%s: file \"%s\"is nota regular file\n"
10481064
"This means you have a corrupted installation or identified\n"
10491065
"the wrong directory with the invocation option -L.\n"),
10501066
progname,path);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp