Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit162e8f1

Browse files
committed
Make saveHistory work properly on OS X when HISTFILE is set to /dev/null.
Per discussion with Martin Atukunda.
1 parent445a612 commit162e8f1

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,boolencodeFlag)
341341
{
342342
#ifdefUSE_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)

[8]ページ先頭

©2009-2025 Movatter.jp