mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Create an fd.c entry point that is just like plain open(2) except that
it will close VFDs if necessary to surmount ENFILE or EMFILE failures. Make use of this in md.c, xlog.c, and user.c routines that were formerly vulnerable to these failures. In particular, this should handle failures of mdblindwrt() that have been observed under heavy load conditions. (By golly, every other process on the system may crash after Postgres eats up all the kernel FDs, but Postgres will keep going!)
This commit is contained in:
@ -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/commands/user.c,v 1.56 2000/05/30 00:49:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.57 2000/06/02 03:58:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -146,13 +146,13 @@ write_password_file(Relation rel)
|
||||
/*
|
||||
* Create a flag file the postmaster will detect the next time it
|
||||
* tries to authenticate a user. The postmaster will know to reload
|
||||
* the pg_pwd file contents. Note: we used to elog(ERROR) if the
|
||||
* creat() call failed, but it's a little silly to abort the transaction
|
||||
* the pg_pwd file contents. Note: we used to elog(ERROR) if the file
|
||||
* creation failed, but it's a little silly to abort the transaction
|
||||
* at this point, so let's just make it a NOTICE.
|
||||
*/
|
||||
filename = crypt_getpwdreloadfilename();
|
||||
flagfd = creat(filename, S_IRUSR | S_IWUSR);
|
||||
if (flagfd == -1)
|
||||
flagfd = BasicOpenFile(filename, O_WRONLY | O_CREAT, 0600);
|
||||
if (flagfd < 0)
|
||||
elog(NOTICE, "%s: %m", filename);
|
||||
else
|
||||
close(flagfd);
|
||||
|
Reference in New Issue
Block a user