Sat Oct 16 00:56:17 PDT 2004
- Previous message: [Slony1-general] Logging Bandwidth Usage - Request For Comment
- Next message: [Slony1-general] Multiple master -> same slave & different database.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/15/2004 6:11 PM, CVS User Account wrote:
> Log Message:
> -----------
> Don't step past the end of the passed in conn_info
>
> Modified Files:
> --------------
> slony1-engine/src/slon:
> slon.c (r1.33 -> r1.34)
>
>
>
> ------------------------------------------------------------------------
>
> Index: slon.c
> ===================================================================
> RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
> retrieving revision 1.33
> retrieving revision 1.34
> diff -Lsrc/slon/slon.c -Lsrc/slon/slon.c -u -w -r1.33 -r1.34
> --- src/slon/slon.c
> +++ src/slon/slon.c
> @@ -61,6 +61,7 @@
> {
> char *cp1;
> char *cp2;
> + char *scratch;
What exactly is the purpose of this variable? It is not used by this
patch, so it must have been missing before.
> SlonDString query;
> PGresult *res;
> int i, n;
> @@ -117,35 +118,6 @@
> break;
> }
> }
> -#if 0
> - fprintf(stderr, "config: vac_frequency %d\n"
> - " sync_group_maxsize %d\n"
> - " sync_interval_timeout %d\n"
> - " sync_interval %d\n"
> - " slon_log_level %d\n"
> - " log_pid %d\n"
> - " log_timestamp %d\n",
> - vac_frequency, sync_group_maxsize, sync_interval_timeout,
> - sync_interval, slon_log_level, logpid, logtimestamp);
> - fflush(NULL);
> -#endif
> - if (argc - optind != 2)
> - errors++;
> -
> - if (errors != 0)
> - {
> - fprintf(stderr, "usage: %s [options] clustername conninfo\n", argv[0]);
> - fprintf(stderr, "\n");
> - fprintf(stderr, "Options:\n");
> - fprintf(stderr, " -d <debuglevel> verbosity of logging (1..4)\n");
> - fprintf(stderr, " -s <milliseconds> SYNC check interval (default 10000)\n");
> - fprintf(stderr, " -t <milliseconds> SYNC interval timeout (default 60000)\n");
> - fprintf(stderr, " -g <num> maximum SYNC group size (default 6)\n");
> - fprintf(stderr, " -c <num> how often to vaccum in cleanup cycles\n");
> - fprintf(stderr, " -p <filename> slon pid file\n");
> - fprintf(stderr, " -f <filename> slon configuration file\n");
> - return 1;
> - }
> /*
> * Make sure the sync interval isn't too small.
> */
> @@ -157,12 +129,20 @@
> * identifier
> */
> slon_pid = getpid();
> - rtcfg_cluster_name = (char *)argv[optind];
> - rtcfg_namespace = malloc(strlen(argv[optind]) * 2 + 4);
> +
> + if ((char *)argv[optind])
> + {
> + set_config_option("cluster_name", (char *)argv[optind]);
> + set_config_option("conn_info", (char *)argv[++optind]);
> + }
> +
> + if (rtcfg_cluster_name != NULL)
> + {
> + rtcfg_namespace = malloc(strlen(rtcfg_cluster_name) * 2 + 4);
> cp2 = rtcfg_namespace;
> *cp2++ = '"';
> *cp2++ = '_';
> - for (cp1 = (char *)argv[optind]; *cp1; cp1++)
> + for (cp1 = (char *)rtcfg_cluster_name; *cp1; cp1++)
> {
> if (*cp1 == '"')
> *cp2++ = '"';
> @@ -170,6 +150,11 @@
> }
> *cp2++ = '"';
> *cp2 = '\0';
> + }
> + else
> + {
> + errors++;
> + }
>
> slon_log(SLON_CONFIG, "main: slon version %s starting up\n",
> SLONY_I_VERSION_STRING);
> @@ -177,12 +162,34 @@
> /*
> * Remember the connection information for the local node.
> */
> - rtcfg_conninfo = (char *)argv[++optind];
> +
> + if (rtcfg_conninfo == NULL)
> + {
> + errors++;
> + }
> +
> + if (errors != 0)
> + {
> + fprintf(stderr, "usage: %s [options] clustername conninfo\n", argv[0]);
> + fprintf(stderr, "\n");
> + fprintf(stderr, "Options:\n");
> + fprintf(stderr, " -d <debuglevel> verbosity of logging (1..4)\n");
> + fprintf(stderr, " -s <milliseconds> SYNC check interval (default 10000)\n");
> + fprintf(stderr, " -t <milliseconds> SYNC interval timeout (default 60000)\n");
> + fprintf(stderr, " -g <num> maximum SYNC group size (default 6)\n");
> + fprintf(stderr, " -c <num> how often to vaccum in cleanup cycles\n");
> + fprintf(stderr, " -p <filename> slon pid file\n");
> + fprintf(stderr, " -f <filename> slon configuration file\n");
> + return 1;
> + }
> +
>
> /*
> * Connect to the local database for reading the initial
> * configuration
> */
> +
> +
> startup_conn = PQconnectdb(rtcfg_conninfo);
> if (startup_conn == NULL)
> {
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Slony1-commit mailing list
> Slony1-commit at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/slony1-commit
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck at Yahoo.com #
- Previous message: [Slony1-general] Logging Bandwidth Usage - Request For Comment
- Next message: [Slony1-general] Multiple master -> same slave & different database.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list