diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index c6cec5e3d..1f7810d58 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -927,7 +927,7 @@ bool SetDBStateFileState(DbState state, bool optional) securec_check_intval(rc, , false); /* Write the new content into a temp file and rename it at last. */ - int fd = open(gaussdb_state_file, O_RDWR, 0); + int fd = open(gaussdb_state_file, O_RDONLY, 0); if (fd == -1) { if (errno == ENOENT && optional) { write_stderr("gaussdb.state does not exist, and skipt setting since it is optional."); @@ -945,7 +945,7 @@ bool SetDBStateFileState(DbState state, bool optional) write_stderr("Failed to read gaussdb.state: %d, len: %d", errno, len); (void)close(fd); (void)unlink(gaussdb_state_file); - return false; + return true; } if (close(fd) != 0) {