Comment added.
> "Michael C. Thornburgh" <zenomt@armory.com> writes:
> >> We already use strdup a lot. Want to send a new patch?
>
> > attached is take-2 of a patch which fixes a bug related
> > to the use of getpwuid when running in standalone mode.
>
> I should have mentioned one more request, which is a comment
> in the code explaining just *why* the strdup is needed.
> Otherwise somebody will delete it someday.
>
> Bruce already applied your v2 patch, but if you can offer
> a one-or-two-line summary suitable for insertion as a comment,
> it'd be appreciated.
>
> regards, tom lane
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
? config.log
? config.cache
? config.status
? GNUmakefile
? src/Makefile.custom
? src/GNUmakefile
? src/Makefile.global
? src/log
? src/crtags
? src/backend/port/Makefile
? src/include/config.h
? src/include/stamp-h
Index: src/backend/main/main.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/main/main.c,v
retrieving revision 1.38
diff -c -r1.38 main.c
*** src/backend/main/main.c 2001/01/24 03:50:06 1.38
--- src/backend/main/main.c 2001/01/24 05:22:55
***************
*** 159,164 ****
--- 159,165 ----
fprintf(stderr, "%s: invalid current euid", argv[0]);
exit(1);
}
+ /* Allocate new memory because later getpwuid() calls can overwrite it */
pw_name_persist = strdup(pw->pw_name);
exit(PostgresMain(argc, argv, argc, argv, pw_name_persist));