From 230cf8d37363e63ad97436b7b47fcf122b6afc6b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 27 Nov 2000 05:36:12 +0000 Subject: [PATCH] Check for link(2) failure. --- src/backend/access/transam/xlog.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index fd99732d21..b31a6182ee 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.34 2000/11/25 20:33:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.35 2000/11/27 05:36:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -860,7 +860,11 @@ XLogFileInit(uint32 log, uint32 seg, bool *usexistent) log, seg, 0); close(fd); - link(tpath, path); + + if (link(tpath, path) < 0) + elog(STOP, "InitRelink(logfile %u seg %u) failed: %m", + logId, logSeg); + unlink(tpath); fd = BasicOpenFile(path, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);