Re: pg_autovacuum log paths can't contain spaces

"Dave Page" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32,gmane.comp.db.postgresql.devel.patches
Message-ID <E7F85A1B5FF8D44C8A1AF6885BC9A0E43065AA@ratbert.vale-housing.co.uk>
 

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf 
> Of Barry Lind
> Sent: 21 September 2004 00:46
> To: [email protected]
> Subject: [pgsql-hackers-win32] pg_autovacuum log paths can't 
> contain spaces
> 
> I just installed the beta2 Dev 3 version of the installer.  
> When I went to go tryout pg_autovacuum I noticed two problem:
> 
> 1) -P isn't working correctly.  -P is being interpreted as -p 
> in the service code and it tries to use the password (-P) 
> that I passed in as the port (-p).  I seem to recall a 
> previous email about this and think this is already fixed in CVS.

Yup, it has been.

> 2) When I specify a path that contains spaces to the -L 
> switch it doesn't work correctly.

The patch below should rectify this.

Regards, Dave.


Index: pg_autovacuum.c
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/contrib/pg_autovacuum/pg_autovacuum.c,v
retrieving revision 1.21
diff -u -r1.21 pg_autovacuum.c
--- pg_autovacuum.c	14 Sep 2004 04:06:20 -0000	1.21
+++ pg_autovacuum.c	21 Sep 2004 09:10:22 -0000
@@ -1217,7 +1217,13 @@
 	if (args->password)
 		sprintf(szCommand, "%s -P %s", szCommand,
args->password);
 	if (args->logfile)
-		sprintf(szCommand, "%s -L %s", szCommand,
args->logfile);
+	{
+		if (strstr(args->logfile, " "))
+			sprintf(szCommand, "%s -L \"%s\"", szCommand,
args->logfile);
+		else
+			sprintf(szCommand, "%s -L %s", szCommand,
args->logfile);
+	}
+	
 	if (args->sleep_base_value != (int) SLEEPBASEVALUE)
 		sprintf(szCommand, "%s -s %i", szCommand,
args->sleep_base_value);
 	if (args->sleep_scaling_factor != (float) SLEEPSCALINGFACTOR)

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [email protected])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.