diff options
author | David Shaw <[email protected]> | 2006-05-27 02:07:05 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2006-05-27 02:07:05 +0000 |
commit | 49c31957f02c4f1373854c6a4493b78cad8d740a (patch) | |
tree | 64302d6b6a45490f65a4e896238fa2bfda826282 /g10/exec.c | |
parent | * exec.c (make_tempdir) [_WIN32]: Modified to properly handle (diff) | |
download | gnupg-49c31957f02c4f1373854c6a4493b78cad8d740a.tar.gz gnupg-49c31957f02c4f1373854c6a4493b78cad8d740a.zip |
Revert last. It is still wrong.
Diffstat (limited to '')
-rw-r--r-- | g10/exec.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/g10/exec.c b/g10/exec.c index 2ad0d327c..d99bb5e1e 100644 --- a/g10/exec.c +++ b/g10/exec.c @@ -129,21 +129,16 @@ static int make_tempdir(struct exec_info *info) if(tmp==NULL) { #if defined (_WIN32) - int tmp_siz; - int len=0; + int err; - /* Poll temp path length */ - tmp_siz=GetTempPath(0,NULL); - if(tmp_siz) - { - tmp=xmalloc(tmp_siz); - len=GetTempPath(tmp_siz,tmp); - } - - if(len==0) - tmp=xstrdup("c:\\windows\\temp"); + tmp=xmalloc(MAX_PATH); + err=GetTempPath(MAX_PATH,tmp); + if(err==0 || err>MAX_PATH) + strcpy(tmp,"c:\\windows\\temp"); else { + int len=strlen(tmp); + /* GetTempPath may return with \ on the end */ while(len>0 && tmp[len-1]=='\\') { |