mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Use get_progname() in backend main.c, rather than port-specific hack
that is too fragile.
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.94 2004/12/31 21:59:53 pgsql Exp $
|
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.95 2005/10/13 15:37:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -50,8 +50,6 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
#endif
|
#endif
|
||||||
@ -256,13 +254,7 @@ main(int argc, char *argv[])
|
|||||||
* (and possibly first argument) we were called with. The lack of
|
* (and possibly first argument) we were called with. The lack of
|
||||||
* consistency here is historical.
|
* consistency here is historical.
|
||||||
*/
|
*/
|
||||||
len = strlen(argv[0]);
|
if (strcmp(get_progname(argv[0]), "postmaster") == 0)
|
||||||
|
|
||||||
if ((len >= 10 && strcmp(argv[0] + len - 10, "postmaster") == 0)
|
|
||||||
#ifdef WIN32
|
|
||||||
|| (len >= 14 && strcmp(argv[0] + len - 14, "postmaster.exe") == 0)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* Called as "postmaster" */
|
/* Called as "postmaster" */
|
||||||
exit(PostmasterMain(argc, argv));
|
exit(PostmasterMain(argc, argv));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/port/path.c,v 1.59 2005/09/27 17:39:35 tgl Exp $
|
* $PostgreSQL: pgsql/src/port/path.c,v 1.60 2005/10/13 15:37:14 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -403,7 +403,7 @@ get_progname(const char *argv0)
|
|||||||
{
|
{
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
progname = strdup(nodir_name);
|
progname = strdup(nodir_name); /* leaks memory, but called only once */
|
||||||
if (progname == NULL)
|
if (progname == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: out of memory\n", nodir_name);
|
fprintf(stderr, "%s: out of memory\n", nodir_name);
|
||||||
|
Reference in New Issue
Block a user