From 36614006e15e2a9d2d866ee57af9320bf482aa7c Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 7 Jun 2010 15:49:30 +0000
Subject: [PATCH] Avoid useless snprintf() call when update_process_title is
 turned off. Fujii Masao

---
 src/backend/replication/walreceiver.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index b31cfb4147d..af5da50b0fb 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -29,7 +29,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.11 2010/06/03 22:17:32 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.12 2010/06/07 15:49:30 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -524,7 +524,6 @@ XLogWalRcvFlush(void)
 	{
 		/* use volatile pointer to prevent code rearrangement */
 		volatile WalRcvData *walrcv = WalRcv;
-		char		activitymsg[50];
 
 		issue_xlog_fsync(recvFile, recvId, recvSeg);
 
@@ -536,8 +535,14 @@ XLogWalRcvFlush(void)
 		SpinLockRelease(&walrcv->mutex);
 
 		/* Report XLOG streaming progress in PS display */
-		snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
-				 LogstreamResult.Write.xlogid, LogstreamResult.Write.xrecoff);
-		set_ps_display(activitymsg, false);
+		if (update_process_title)
+		{
+			char		activitymsg[50];
+
+			snprintf(activitymsg, sizeof(activitymsg), "streaming %X/%X",
+					 LogstreamResult.Write.xlogid,
+					 LogstreamResult.Write.xrecoff);
+			set_ps_display(activitymsg, false);
+		}
 	}
 }
-- 
GitLab