Sat Jul 10 20:13:34 PDT 2004
- Previous message: [Slony1-general] Password showing in 'ps' listings
- Next message: [Slony1-general] Password showing in 'ps' listings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sure, no problem. For my education, what made changing argv a headache? -Erik > On 7/10/2004 1:47 PM, Erik G. Burrows wrote: > > > I've only been using Slony-I for a few days, but I already love it! It's > > going to make database migrations and upgrades much, much easier. > > However, I didn't like the fact that the PostgreSQL connection string > > passed to the slon process shows up in 'ps' output. > > > > Attached is my patch to slon.c to erase the argv entry with the > > connection string after slon finishes processing it's arguments, and > > restore it in case of a restart. I'm not sure how portable this fix is, > > but it should work on most *nix platforms, I think. I hope you find it > > useful. > > We know from the PostgreSQL main project how much of a headache mucking > with the commandline arguments is. I would much more prefer changing the > slony commandline into taking a filename argument where to find all the > configuration parameters that are now passed with switches. Would you be > willing to rework it into something like that? > > > Jan > > > > > Thanks, > > Erik G. Burrows > > > > > > > > ------------------------------------------------------------------------ > > > > Index: slon.c > > =================================================================== > > RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v > > retrieving revision 1.27 > > diff -c -r1.27 slon.c > > *** slon.c 8 Jun 2004 15:15:49 -0000 1.27 > > --- slon.c 10 Jul 2004 17:35:14 -0000 > > *************** > > *** 52,57 **** > > --- 52,58 ---- > > static char *const *main_argv; > > static void sigalrmhandler(int signo); > > > > + int conn_param_argv_idx; > > > > /* ---------- > > * main > > *************** > > *** 174,179 **** > > --- 175,187 ---- > > rtcfg_conninfo = (char *)argv[++optind]; > > > > /* > > + * Remove the connection params from argv, so as not to show up in 'ps' listings, but save > > + * it's position within the argv array, as we'll need to put it back in the case of a restart. > > + */ > > + conn_param_argv_idx = optind; > > + bzero((char *)argv[conn_param_argv_idx], strlen((char *)argv[conn_param_argv_idx])); > > + > > + /* > > * Connect to the local database for reading the initial configuration > > */ > > startup_conn = PQconnectdb(rtcfg_conninfo); > > *************** > > *** 520,525 **** > > --- 528,537 ---- > > if (slon_restart_request) > > { > > slon_log(SLON_DEBUG1, "main: restart requested\n"); > > + > > + /* Put the connection param argv element back */ > > + strcpy(argv[conn_param_argv_idx], rtcfg_conninfo); > > + > > execvp(argv[0], argv); > > slon_log(SLON_FATAL, > > "main: cannot restart via execvp(): %s\n", strerror(errno)); > > *************** > > *** 551,556 **** > > --- 563,571 ---- > > slon_log(SLON_WARN, "main: shutdown timeout\n"); > > if (slon_restart_request) > > { > > + /* Put the connection param argv element back */ > > + strcpy(main_argv[conn_param_argv_idx], rtcfg_conninfo); > > + > > execvp(main_argv[0], main_argv); > > slon_log(SLON_FATAL, > > "main: cannot restart via execvp(): %s\n", strerror(errno)); > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Slony1-general mailing list > > Slony1-general at gborg.postgresql.org > > http://gborg.postgresql.org/mailman/listinfo/slony1-general -- Erik G. Burrows - KG6HEA www.erikburrows.com PGP Key: http://www.erikburrows.com/files/erik.erikburrows.com.pgpkey
- Previous message: [Slony1-general] Password showing in 'ps' listings
- Next message: [Slony1-general] Password showing in 'ps' listings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list