aboutsummaryrefslogtreecommitdiffstats
path: root/tests/asschk.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2002-09-04 13:04:49 +0000
committerMarcus Brinkmann <[email protected]>2002-09-04 13:04:49 +0000
commitcfca45dcd5edab3a7f251c10fbf40339652d7687 (patch)
tree9ea5a2db60424bcf84075a6d1f88a9a715d1de16 /tests/asschk.c
parent2002-09-03 Neal H. Walfield <[email protected]> (diff)
downloadgnupg-cfca45dcd5edab3a7f251c10fbf40339652d7687.tar.gz
gnupg-cfca45dcd5edab3a7f251c10fbf40339652d7687.zip
2002-09-04 Marcus Brinkmann <[email protected]>
* asschk.c (start_server): Close the parent's file descriptors in the child. (read_assuan): Variable NREAD removed. Cut off the received line currectly if more than one line was read.
Diffstat (limited to 'tests/asschk.c')
-rw-r--r--tests/asschk.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/asschk.c b/tests/asschk.c
index 829c86273..1a11ead33 100644
--- a/tests/asschk.c
+++ b/tests/asschk.c
@@ -267,7 +267,6 @@ read_assuan (int fd)
size_t nleft = sizeof recv_line;
char *buf = recv_line;
char *p;
- int nread = 0;
while (nleft > 0)
{
@@ -294,7 +293,6 @@ read_assuan (int fd)
p = buf;
nleft -= n;
buf += n;
- nread += n;
for (; n && *p != '\n'; n--, p++)
;
@@ -303,16 +301,15 @@ read_assuan (int fd)
if (n>1)
{
n--;
- memcpy (pending, p+1, n);
+ memcpy (pending, p + 1, n);
pending_len = n;
}
+ *p = '\0';
break;
}
}
if (!nleft)
die ("received line too large");
- assert (nread>0);
- recv_line[nread-1] = 0;
p = recv_line;
if (p[0] == 'O' && p[1] == 'K' && (p[2] == ' ' || !p[2]))
@@ -420,6 +417,8 @@ start_server (const char *pgmname)
close (fd);
}
+ close (wp[1]);
+ close (rp[0]);
execl (pgmname, arg0, "--server", NULL);
die ("exec failed for `%s': %s", pgmname, strerror (errno));
}