summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-04-15 16:40:48 +0200
committerWerner Koch <wk@gnupg.org>2014-04-22 15:02:05 +0200
commit1a87edab6657a257876ab2f8790f2937feba7066 (patch)
tree5dc04c43a71388a9437dbfc5d1686d69556210b0 /tools
parentgpg: Print a warning if GKR has hijacked gpg-agent. (diff)
downloadgnupg2-1a87edab6657a257876ab2f8790f2937feba7066.tar.xz
gnupg2-1a87edab6657a257876ab2f8790f2937feba7066.zip
common: Add function gnupg_getcwd.
* tools/gpg-connect-agent.c (gnu_getcwd): Move to ... * common/sysutils.c (gnupg_getcwd): .. here. * tools/gpg-connect-agent.c (get_var_ext): Use gnupg_getcwd.
Diffstat (limited to 'tools')
-rw-r--r--tools/gpg-connect-agent.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index 81e981b2c..07c3391d3 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -212,30 +212,6 @@ my_strusage( int level )
}
-static char *
-gnu_getcwd (void)
-{
- char *buffer;
- size_t size = 100;
-
- for (;;)
- {
- buffer = xmalloc (size+1);
-#ifdef HAVE_W32CE_SYSTEM
- strcpy (buffer, "/");
- return buffer;
-#else
- if (getcwd (buffer, size) == buffer)
- return buffer;
- xfree (buffer);
- if (errno != ERANGE)
- return NULL;
- size *= 2;
-#endif
- }
-}
-
-
/* Unescape STRING and returned the malloced result. The surrounding
quotes must already be removed from STRING. */
static char *
@@ -568,7 +544,7 @@ get_var_ext (const char *name)
s++;
if (!strcmp (s, "cwd"))
{
- result = gnu_getcwd ();
+ result = gnupg_getcwd ();
if (!result)
log_error ("getcwd failed: %s\n", strerror (errno));
}