Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit32e6c2a

Browse files
committed
Use get_progname() in backend main.c, rather than port-specific hack
that is too fragile.
1 parent203015e commit32e6c2a

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

‎src/backend/main/main.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.94 2004/12/31 21:59:53 pgsql Exp $
16+
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.95 2005/10/13 15:37:14 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -50,8 +50,6 @@
5050
int
5151
main(intargc,char*argv[])
5252
{
53-
intlen;
54-
5553
#ifndefWIN32
5654
structpasswd*pw;
5755
#endif
@@ -256,13 +254,7 @@ main(int argc, char *argv[])
256254
* (and possibly first argument) we were called with. The lack of
257255
* consistency here is historical.
258256
*/
259-
len=strlen(argv[0]);
260-
261-
if ((len >=10&&strcmp(argv[0]+len-10,"postmaster")==0)
262-
#ifdefWIN32
263-
|| (len >=14&&strcmp(argv[0]+len-14,"postmaster.exe")==0)
264-
#endif
265-
)
257+
if (strcmp(get_progname(argv[0]),"postmaster")==0)
266258
{
267259
/* Called as "postmaster" */
268260
exit(PostmasterMain(argc,argv));

‎src/port/path.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.59 2005/09/27 17:39:35 tgl Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.60 2005/10/13 15:37:14 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -403,7 +403,7 @@ get_progname(const char *argv0)
403403
{
404404
char*progname;
405405

406-
progname=strdup(nodir_name);
406+
progname=strdup(nodir_name);/* leaks memory, but called only once */
407407
if (progname==NULL)
408408
{
409409
fprintf(stderr,"%s: out of memory\n",nodir_name);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp