*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.57 2006/07/14 14:52:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.58 2006/08/27 15:05:20 tgl Exp $
*/
#include "postgres_fe.h"
saveHistory(char *fname, bool encodeFlag)
{
#ifdef USE_READLINE
- if (useHistory && fname)
+ /*
+ * Suppressing the write attempt when HISTFILE is set to /dev/null
+ * may look like a negligible optimization, but it's necessary on e.g.
+ * Darwin, where write_history will fail because it tries to chmod
+ * the target file.
+ */
+ if (useHistory && fname &&
+ strcmp(fname, DEVNULL) != 0)
{
if (encodeFlag)
encode_history();