Content-Length: 285795 | pFad | http://github.com/postgrespro/postgres_cluster/commit/162e8f1fd53eb485e0b7c22331444f245420d3ba

56 Make saveHistory work properly on OS X when HISTFILE is set to /dev/n… · postgrespro/postgres_cluster@162e8f1 · GitHub
Skip to content

Commit 162e8f1

Browse files
committed
Make saveHistory work properly on OS X when HISTFILE is set to /dev/null.
Per discussion with Martin Atukunda.
1 parent 445a612 commit 162e8f1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/bin/psql/input.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.57 2006/07/14 14:52:26 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.58 2006/08/27 15:05:20 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -340,7 +340,14 @@ bool
340340
saveHistory(char *fname, bool encodeFlag)
341341
{
342342
#ifdef USE_READLINE
343-
if (useHistory && fname)
343+
/*
344+
* Suppressing the write attempt when HISTFILE is set to /dev/null
345+
* may look like a negligible optimization, but it's necessary on e.g.
346+
* Darwin, where write_history will fail because it tries to chmod
347+
* the target file.
348+
*/
349+
if (useHistory && fname &&
350+
strcmp(fname, DEVNULL) != 0)
344351
{
345352
if (encodeFlag)
346353
encode_history();

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/162e8f1fd53eb485e0b7c22331444f245420d3ba

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy