summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2010-08-22 18:15:05 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2010-08-22 18:15:05 +0000
commitf164136dd39ca93e2e2c60ea01f44fec255a620d (patch)
treea46b2b666411ce4ec29d70c2b3ef8047a145fdb6
parentaf13114d8eba18cc2d20b2d9f24ac703cb2f7f08 (diff)
cleanup a couple of decades old zwrite nits
Don't free the incoming notice if we don't know for sure there's one. Drop the message on read error in the tty case.
-rw-r--r--clients/zwrite/zwrite.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c
index 4b18def..240fdd4 100644
--- a/clients/zwrite/zwrite.c
+++ b/clients/zwrite/zwrite.c
@@ -322,6 +322,8 @@ main(int argc, char *argv[])
(void) strcpy(message+msgsize, bfr);
msgsize += l;
}
+ if (ferror(stdin)) /* drop the message */
+ exit(1);
message = realloc(message, (unsigned)(msgsize+1));
}
else { /* Use read so you can send binary messages... */
@@ -392,9 +394,7 @@ send_off(ZNotice_t *notice, int real)
}
if ((retval = ZIfNotice(&retnotice, (struct sockaddr_in *) 0,
ZCompareUIDPred,
- (char *)&notice->z_uid)) !=
- ZERR_NONE) {
- ZFreeNotice(&retnotice);
+ (char *)&notice->z_uid)) != ZERR_NONE) {
(void) sprintf(bfr, "while waiting for acknowledgement for %s",
dest);
com_err(whoami, retval, bfr);