mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-08 17:43:04 +01: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:
parent
fe01cbceb0
commit
c336e34571
@ -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>
|
2005-03-31 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* keydb.c (keydb_add_resource): Clarify meaning of flags. Add new
|
* keydb.c (keydb_add_resource): Clarify meaning of flags. Add new
|
||||||
|
26
g10/exec.c
26
g10/exec.c
@ -1,5 +1,5 @@
|
|||||||
/* exec.c - generic call-a-program code
|
/* 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.
|
* 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_read(struct exec_info *info) { return G10ERR_GENERAL; }
|
||||||
int exec_finish(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 */
|
#else /* ! NO_EXEC */
|
||||||
|
|
||||||
@ -91,29 +91,17 @@ static int win_system(const char *command)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* method==0 to replace current $PATH, and 1 to append to current
|
/* Replaces current $PATH */
|
||||||
$PATH. */
|
int set_exec_path(const char *path)
|
||||||
int set_exec_path(const char *path,int method)
|
|
||||||
{
|
{
|
||||||
char *p,*curpath=NULL;
|
char *p;
|
||||||
size_t curlen=0;
|
|
||||||
|
|
||||||
if(method==1 && (curpath=getenv("PATH")))
|
p=m_alloc(5+strlen(path)+1);
|
||||||
curlen=strlen(curpath)+1;
|
|
||||||
|
|
||||||
p=m_alloc(5+curlen+strlen(path)+1);
|
|
||||||
strcpy(p,"PATH=");
|
strcpy(p,"PATH=");
|
||||||
|
|
||||||
if(curpath)
|
|
||||||
{
|
|
||||||
strcat(p,curpath);
|
|
||||||
strcat(p,":");
|
|
||||||
}
|
|
||||||
|
|
||||||
strcat(p,path);
|
strcat(p,path);
|
||||||
|
|
||||||
if(DBG_EXTPROG)
|
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
|
/* Notice that path is never freed. That is intentional due to the
|
||||||
way putenv() works. This leaks a few bytes if we call
|
way putenv() works. This leaks a few bytes if we call
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* exec.h
|
/* 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.
|
* 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);
|
const char *args_in,const char *name,int writeonly,int binary);
|
||||||
int exec_read(struct exec_info *info);
|
int exec_read(struct exec_info *info);
|
||||||
int exec_finish(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_ */
|
#endif /* !_EXEC_H_ */
|
||||||
|
@ -2379,7 +2379,7 @@ main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
|
case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
|
||||||
case oExecPath:
|
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);
|
log_error(_("unable to set exec-path to %s\n"),pargs.r.ret_str);
|
||||||
else
|
else
|
||||||
opt.exec_path_set=1;
|
opt.exec_path_set=1;
|
||||||
|
@ -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
|
Unix-like systems (since we're going to give a full path to
|
||||||
gpgkeys_foo), but on W32 it prevents loading any DLLs from
|
gpgkeys_foo), but on W32 it prevents loading any DLLs from
|
||||||
directories in %PATH%. */
|
directories in %PATH%. */
|
||||||
set_exec_path(GNUPG_LIBEXECDIR,0);
|
set_exec_path(GNUPG_LIBEXECDIR);
|
||||||
#else
|
#else
|
||||||
if(opt.exec_path_set)
|
if(opt.exec_path_set)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user