1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-25 01:42:45 +02:00

* exec.h, exec.c (set_exec_path): Remove some dead code and change all

callers.  We no longer need to append to $PATH.
This commit is contained in:
David Shaw 2005-03-31 17:11:53 +00:00
parent fe01cbceb0
commit c336e34571
5 changed files with 16 additions and 23 deletions

View File

@ -1,3 +1,8 @@
2005-03-31 David Shaw <dshaw@jabberwocky.com>
* exec.h, exec.c (set_exec_path): Remove some dead code and change
all callers. We no longer need to append to $PATH.
2005-03-31 Werner Koch <wk@g10code.com>
* keydb.c (keydb_add_resource): Clarify meaning of flags. Add new

View File

@ -1,5 +1,5 @@
/* exec.c - generic call-a-program code
* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -51,7 +51,7 @@ int exec_write(struct exec_info **info,const char *program,
int exec_read(struct exec_info *info) { return G10ERR_GENERAL; }
int exec_finish(struct exec_info *info) { return G10ERR_GENERAL; }
int set_exec_path(const char *path,int method) { return G10ERR_GENERAL; }
int set_exec_path(const char *path) { return G10ERR_GENERAL; }
#else /* ! NO_EXEC */
@ -91,29 +91,17 @@ static int win_system(const char *command)
}
#endif
/* method==0 to replace current $PATH, and 1 to append to current
$PATH. */
int set_exec_path(const char *path,int method)
/* Replaces current $PATH */
int set_exec_path(const char *path)
{
char *p,*curpath=NULL;
size_t curlen=0;
char *p;
if(method==1 && (curpath=getenv("PATH")))
curlen=strlen(curpath)+1;
p=m_alloc(5+curlen+strlen(path)+1);
p=m_alloc(5+strlen(path)+1);
strcpy(p,"PATH=");
if(curpath)
{
strcat(p,curpath);
strcat(p,":");
}
strcat(p,path);
if(DBG_EXTPROG)
log_debug("set_exec_path method %d: %s\n",method,p);
log_debug("set_exec_path: %s\n",p);
/* Notice that path is never freed. That is intentional due to the
way putenv() works. This leaks a few bytes if we call

View File

@ -1,5 +1,5 @@
/* exec.h
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
* Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -38,6 +38,6 @@ int exec_write(struct exec_info **info,const char *program,
const char *args_in,const char *name,int writeonly,int binary);
int exec_read(struct exec_info *info);
int exec_finish(struct exec_info *info);
int set_exec_path(const char *path,int method);
int set_exec_path(const char *path);
#endif /* !_EXEC_H_ */

View File

@ -2379,7 +2379,7 @@ main( int argc, char **argv )
break;
case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
case oExecPath:
if(set_exec_path(pargs.r.ret_str,0))
if(set_exec_path(pargs.r.ret_str))
log_error(_("unable to set exec-path to %s\n"),pargs.r.ret_str);
else
opt.exec_path_set=1;

View File

@ -876,7 +876,7 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
Unix-like systems (since we're going to give a full path to
gpgkeys_foo), but on W32 it prevents loading any DLLs from
directories in %PATH%. */
set_exec_path(GNUPG_LIBEXECDIR,0);
set_exec_path(GNUPG_LIBEXECDIR);
#else
if(opt.exec_path_set)
{