*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.140 2008/11/11 13:19:16 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.141 2008/11/14 11:09:50 heikki Exp $
*
*-------------------------------------------------------------------------
*/
fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
if (fd < 0)
{
- pfree(path);
/* be sure to report the error reported by create, not open */
errno = save_errno;
ereport(ERROR,
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
if (fd < 0)
{
- pfree(path);
if (behavior == EXTENSION_RETURN_NULL &&
FILE_POSSIBLY_DELETED(errno))
+ {
+ pfree(path);
return NULL;
+ }
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not open relation %s: %m", path)));