Chris Browne cbbrowne at lists.slony.info
Fri Mar 7 11:01:39 PST 2008
Update of /home/cvsd/slony1/slony1-engine/src/slonik
In directory main.slony.info:/tmp/cvs-serv26264

Modified Files:
      Tag: REL_1_2_STABLE
	Makefile slonik.c 
Log Message:
http://www.slony.info/bugzilla/show_bug.cgi?id=35

Patch to search the Slony share dir for scripts before falling back to the PG
share dir on 8.0+

- Per Dave Page



Index: slonik.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.67.2.15
retrieving revision 1.67.2.16
diff -C2 -d -r1.67.2.15 -r1.67.2.16
*** slonik.c	14 Feb 2008 21:51:07 -0000	1.67.2.15
--- slonik.c	7 Mar 2008 19:01:37 -0000	1.67.2.16
***************
*** 80,83 ****
--- 80,84 ----
  	extern int	optind;
  	int			opt;
+ 	char 		script[MAXPGPATH];
  
  	while ((opt = getopt(argc, (char **)argv, "hv")) != EOF)
***************
*** 104,119 ****
  		usage();
  
! 	/*
! 	 * We need to find a share directory like PostgreSQL. 
! 	 */
! 	if (find_my_exec(argv[0],myfull_path) < 0)
! 	{
! 		strcpy(share_path, PGSHARE);
! 	}
! 	else
  	{
! 		get_share_path(myfull_path, share_path);
  	}
  
  	if (optind < argc)
  	{
--- 105,137 ----
  		usage();
  
! 	/* Check PGSHARE for scripts first */
! 	strcpy(share_path, PGSHARE);
! 
! /* There's no libpgport on 7.x, but on later versions we have other options */
! #if (PG_VERSION_MAJOR > 7)
! 
! 	/* If we can't find the scripts, try the PostgreSQL share directory */
! #ifndef WIN32
! 	snprintf(script, sizeof(script), "%s/slony1_funcs.sql", share_path);
! 	if (access(script, R_OK) != 0)
! #else
! 	_snprintf(script, sizeof(script), "%s/slony1_funcs.sql", share_path);
! 	if (_access(script, 04) != 0)
! 
! #endif
  	{
! 		if (find_my_exec(argv[0],myfull_path) >= 0)
! 		{
! 			get_share_path(myfull_path, share_path);
! 		}
! 		else
! 		{
! 			printf("full path was unacquirable. '%s'\n", argv[0]);
! 			return -1;
! 		}
  	}
  
+ #endif
+ 
  	if (optind < argc)
  	{

Index: Makefile
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/Makefile,v
retrieving revision 1.24.2.1
retrieving revision 1.24.2.2
diff -C2 -d -r1.24.2.1 -r1.24.2.2
*** Makefile	8 Jan 2008 20:42:41 -0000	1.24.2.1
--- Makefile	7 Mar 2008 19:01:37 -0000	1.24.2.2
***************
*** 17,22 ****
  endif
  
! CFLAGS += -I$(slony_top_builddir) -DPGSHARE="\"$(pgsharedir)\"" 
  LDFLAGS += -lpgport
  
  PROG		= slonik
--- 17,24 ----
  endif
  
! CFLAGS += -I$(slony_top_builddir) -DPGSHARE="\"$(pgsharedir)\"" -DPG_VERSION_MAJOR=$(PG_VERSION_MAJOR)
! ifneq ($(PG_VERSION_MAJOR), 7)
  LDFLAGS += -lpgport
+ endif
  
  PROG		= slonik



More information about the Slony1-commit mailing list