On 2014-03-25 21:09:13 +0900, MauMau wrote:
> ! /*
> ! * Remove old symlink in recovery, in case it points to the wrong place.
> ! * On Windows, lstat() reports junction points as directories.
> ! */
> if (InRecovery)
> {
> ! if (lstat(linkloc, &st) == 0 && S_ISDIR(st.st_mode))
> ! {
> ! if (rmdir(linkloc) < 0)
> ! ereport(ERROR,
> ! (errcode_for_file_access(),
> ! errmsg("could not remove directory \"%s\": %m",
> ! linkloc)));
> ! }
> ! else
> ! {
> ! if (unlink(linkloc) < 0 && errno != ENOENT)
> ! ereport(ERROR,
> ! (errcode_for_file_access(),
> ! errmsg("could not remove symbolic link \"%s\": %m",
> ! linkloc)));
> ! }
> }
if (..) ...
else
{ if (...) ...
}
is pretty odd code layout.
Greetings,
Andres Freund
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services