From 1a87edab6657a257876ab2f8790f2937feba7066 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 15 Apr 2014 16:40:48 +0200 Subject: 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. --- tools/gpg-connect-agent.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'tools/gpg-connect-agent.c') 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)); } -- cgit v1.2.3