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

Commit99f50dd

Browse files
committed
initdb -S should now have an explicit check that $PGDATA is valid.
The fsync code from the backend essentially assumes that somebody's alreadyvalidated PGDATA, at least to the extent of it being a readable directory.That's safe enough for initdb's normal code path too, but "initdb -S"doesn't have any other processing at all that touches the target directory.To have reasonable error-case behavior, add a pg_check_dir call.Per gripe from Peter E.
1 parent70a4519 commit99f50dd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3726,10 +3726,19 @@ main(int argc, char *argv[])
37263726
exit(1);
37273727
}
37283728

3729-
/* If we only need to fsync, justto it and exit */
3729+
/* If we only need to fsync, justdo it and exit */
37303730
if (sync_only)
37313731
{
37323732
setup_pgdata();
3733+
3734+
/* must check that directory is readable */
3735+
if (pg_check_dir(pg_data) <=0)
3736+
{
3737+
fprintf(stderr,_("%s: could not access directory \"%s\": %s\n"),
3738+
progname,pg_data,strerror(errno));
3739+
exit_nicely();
3740+
}
3741+
37333742
fsync_pgdata();
37343743
return0;
37353744
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp