Re: get_progname and .exe suffix

Andrew Dunstan <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>

Tom Lane wrote:

>Andrew Dunstan <[email protected]> writes:
>  
>
>>Tom Lane wrote:
>>    
>>
>>>What would break if we caused get_progname itself to strip the suffix?
>>>      
>>>
>
>  
>
>>Yes. get_progname() actually just returns a pointer to one past the last 
>>directory separator it finds in its argument string. Having it strip the 
>>.exe directly would in effect involve mangling argv[0]. That's what 
>>makes me slightly nervous about it. We could have it strdup() the result 
>>and then mangle that - note that it is called by postmaster before we 
>>set up any memory context stuff.
>>    
>>
>
>Seems reasonable.  What I was more worried about though was whether
>there are any callers that actually need a non-stripped result.
>  
>

Ok, I will have a look. grep tells me it's called in these places:

./src/backend/postmaster/postmaster.c
./src/bin/initdb/initdb.c
./src/bin/pg_config/pg_config.c
./src/bin/pg_controldata/pg_controldata.c
./src/bin/pg_ctl/pg_ctl.c
./src/bin/pg_dump/pg_dump.c
./src/bin/pg_dump/pg_dumpall.c
./src/bin/pg_dump/pg_restore.c
./src/bin/pg_resetxlog/pg_resetxlog.c
./src/bin/psql/startup.c
./src/bin/scripts/clusterdb.c
./src/bin/scripts/common.c
./src/bin/scripts/createdb.c
./src/bin/scripts/createlang.c
./src/bin/scripts/createuser.c
./src/bin/scripts/dropdb.c
./src/bin/scripts/droplang.c
./src/bin/scripts/dropuser.c
./src/bin/scripts/vacuumdb.c
./src/interfaces/ecpg/preproc/ecpg.c

cheers

andrew




---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.