diff options
author | Marcus Brinkmann <mb@g10code.com> | 2002-09-04 15:04:49 +0200 |
---|---|---|
committer | Marcus Brinkmann <mb@g10code.com> | 2002-09-04 15:04:49 +0200 |
commit | cfca45dcd5edab3a7f251c10fbf40339652d7687 (patch) | |
tree | 9ea5a2db60424bcf84075a6d1f88a9a715d1de16 | |
parent | 2002-09-03 Neal H. Walfield <neal@cs.uml.edu> (diff) | |
download | gnupg2-cfca45dcd5edab3a7f251c10fbf40339652d7687.tar.xz gnupg2-cfca45dcd5edab3a7f251c10fbf40339652d7687.zip |
2002-09-04 Marcus Brinkmann <marcus@g10code.de>
* 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.
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/asschk.c | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index bfada39b0..940a37bf5 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2002-09-04 Marcus Brinkmann <marcus@g10code.de> + + * 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. + 2002-09-03 Neal H. Walfield <neal@cs.uml.edu> * Makefile.am (inittests.stamp): Construct an LD_LIBRARY_PATH from 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)); } |