diff --git a/src/backend/backup/basebackup_server.c b/src/backend/backup/basebackup_server.c index d020a92bfa..2e29f6a092 100644 --- a/src/backend/backup/basebackup_server.c +++ b/src/backend/backup/basebackup_server.c @@ -143,7 +143,7 @@ bbsink_server_begin_archive(bbsink *sink, const char *archive_name) mysink->file = PathNameOpenFile(filename, O_CREAT | O_EXCL | O_WRONLY | PG_BINARY); - if (mysink->file <= 0) + if (mysink->file < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not create file \"%s\": %m", filename))); @@ -236,7 +236,7 @@ bbsink_server_begin_manifest(bbsink *sink) mysink->file = PathNameOpenFile(tmp_filename, O_CREAT | O_EXCL | O_WRONLY | PG_BINARY); - if (mysink->file <= 0) + if (mysink->file < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not create file \"%s\": %m", tmp_filename))); diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 20c3741aa1..bdd82679fd 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -1629,7 +1629,7 @@ PathNameDeleteTemporaryDir(const char *dirname) File OpenTemporaryFile(bool interXact) { - File file = 0; + File file = -1; Assert(temporary_files_allowed); /* check temp file access is up */ @@ -1662,7 +1662,7 @@ OpenTemporaryFile(bool interXact) * tablespace. MyDatabaseTableSpace should normally be set before we get * here, but just in case it isn't, fall back to pg_default tablespace. */ - if (file <= 0) + if (file < 0) file = OpenTemporaryFileInTablespace(MyDatabaseTableSpace ? MyDatabaseTableSpace : DEFAULTTABLESPACE_OID, @@ -1728,7 +1728,7 @@ OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError) */ file = PathNameOpenFile(tempfilepath, O_RDWR | O_CREAT | O_TRUNC | PG_BINARY); - if (file <= 0) + if (file < 0) { /* * We might need to create the tablespace's tempfile directory, if no @@ -1742,7 +1742,7 @@ OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError) file = PathNameOpenFile(tempfilepath, O_RDWR | O_CREAT | O_TRUNC | PG_BINARY); - if (file <= 0 && rejectError) + if (file < 0 && rejectError) elog(ERROR, "could not create temporary file \"%s\": %m", tempfilepath); } @@ -1777,7 +1777,7 @@ PathNameCreateTemporaryFile(const char *path, bool error_on_failure) * temp file that can be reused. */ file = PathNameOpenFile(path, O_RDWR | O_CREAT | O_TRUNC | PG_BINARY); - if (file <= 0) + if (file < 0) { if (error_on_failure) ereport(ERROR, @@ -1815,7 +1815,7 @@ PathNameOpenTemporaryFile(const char *path, int mode) file = PathNameOpenFile(path, mode | PG_BINARY); /* If no such file, then we don't raise an error. */ - if (file <= 0 && errno != ENOENT) + if (file < 0 && errno != ENOENT) ereport(ERROR, (errcode_for_file_access(), errmsg("could not open temporary file \"%s\": %m", diff --git a/src/backend/storage/file/fileset.c b/src/backend/storage/file/fileset.c index 9c63f2b267..367d975fff 100644 --- a/src/backend/storage/file/fileset.c +++ b/src/backend/storage/file/fileset.c @@ -100,7 +100,7 @@ FileSetCreate(FileSet *fileset, const char *name) file = PathNameCreateTemporaryFile(path, false); /* If we failed, see if we need to create the directory on demand. */ - if (file <= 0) + if (file < 0) { char tempdirpath[MAXPGPATH]; char filesetpath[MAXPGPATH];