resource leak. Of course, any such failure aborts pg_upgrade, but might
as well be clean about it.
Per patch from Grzegorz Ja?kiewicz.
return "can't open source file";
if ((dstfd = open(dst, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
+ {
+ fclose(src_fd);
return "can't create destination file";
+ }
while ((bytesRead = read(src_fd, buf, BLCKSZ)) == BLCKSZ)
{
return "can't open relation";
if ((bytesRead = read(relfd, &page, sizeof(page))) != sizeof(page))
+ {
+ close(relfd);
return "can't read page header";
+ }
*version = PageGetPageLayoutVersion(&page);