summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-09-19 10:58:48 +0000
committerWerner Koch <wk@gnupg.org>2006-09-19 10:58:48 +0000
commit32a50e84da66d6a20703d131f3e8bc6ac10e4422 (patch)
tree5c5142ecb4c12e00f7f8886038d85b2b4c19c9bb /tests
parent2c22ab8151bd504d32ace8755945e6d323c06107 (diff)
downloadlibassuan-32a50e84da66d6a20703d131f3e8bc6ac10e4422.tar.gz
Fixed problems Nelson H. F. Beebe reported when doing build tests on several
platforms.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/fdpassing.c22
2 files changed, 6 insertions, 17 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7121f8e..ef2510e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,7 +29,6 @@ CLEANFILES =
TESTS = fdpassing
-AM_CPPFLAGS = -DSRCDIR=$(srcdir)
AM_CFLAGS = # $(GPG_ERROR_CFLAGS)
noinst_HEADERS = common.h
diff --git a/tests/fdpassing.c b/tests/fdpassing.c
index da85bf7..733c232 100644
--- a/tests/fdpassing.c
+++ b/tests/fdpassing.c
@@ -32,13 +32,6 @@
#include "../src/assuan.h"
#include "common.h"
-#ifndef SRCDIR
-#define SRCDIR "/etc"
-#endif
-#define STRINGIFY2(str) #str
-#define STRINGIFY(str) STRINGIFY2(str)
-#define MOTD STRINGIFY(SRCDIR) "/motd"
-
/*
@@ -65,7 +58,6 @@ cmd_echo (assuan_context_t ctx, char *line)
log_error ("fdopen failed on input fd: %s\n", strerror (errno));
return ASSUAN_General_Error;
}
- log_info ("printing input to stdout:\n");
nbytes = 0;
while ( (c=getc (fp)) != -1)
{
@@ -155,7 +147,7 @@ server (void)
/* Client main. If true is returned, a disconnect has not been done. */
static int
-client (assuan_context_t ctx)
+client (assuan_context_t ctx, const char *fname)
{
int rc;
FILE *fp;
@@ -166,10 +158,10 @@ client (assuan_context_t ctx)
for (i=0; i < 6; i++)
{
- fp = fopen (MOTD, "r");
+ fp = fopen (fname, "r");
if (!fp)
{
- log_error ("failed to open `%s': %s\n", MOTD,
+ log_error ("failed to open `%s': %s\n", fname,
strerror (errno));
return -1;
}
@@ -217,16 +209,13 @@ int
main (int argc, char **argv)
{
int last_argc = -1;
- const char *srcdir = getenv ("srcdir");
assuan_context_t ctx;
int err;
int no_close_fds[2];
const char *arglist[10];
int is_server = 0;
int with_exec = 0;
-
- if (!srcdir)
- srcdir = ".";
+ char *fname = prepend_srcdir ("motd");
if (argc)
{
@@ -269,6 +258,7 @@ main (int argc, char **argv)
}
}
+
assuan_set_assuan_log_prefix (log_prefix);
assuan_set_assuan_log_stream (stderr);
@@ -304,7 +294,7 @@ main (int argc, char **argv)
}
else
{
- if (client (ctx))
+ if (client (ctx, fname))
{
log_info ("waiting for server to terminate...\n");
assuan_disconnect (ctx);