summaryrefslogtreecommitdiff
path: root/lib/ZRetSubs.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1988-06-17 13:22:30 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1988-06-17 13:22:30 +0000
commit672902fefc4c107511405bd27b522dac08cb0279 (patch)
tree21cccf5b83d0bf2a764a8f5b8f54e3801c69f314 /lib/ZRetSubs.c
parentbf48877666da9eb8a3abaf18a6f5c61bca2f5e88 (diff)
need to use a real port
default format needs to be at least "" compare MultiUID's free up used resources
Diffstat (limited to 'lib/ZRetSubs.c')
-rw-r--r--lib/ZRetSubs.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/ZRetSubs.c b/lib/ZRetSubs.c
index 6ca8de4..610244c 100644
--- a/lib/ZRetSubs.c
+++ b/lib/ZRetSubs.c
@@ -37,15 +37,21 @@ Code_t ZRetrieveSubscriptions(port,nsubs)
if (retval != ZERR_NONE && retval != ZERR_NOSUBSCRIPTIONS)
return (retval);
+ if (ZGetFD() < 0)
+ if ((retval = ZOpenPort((u_short *)0)) != ZERR_NONE)
+ return (retval);
+
notice.z_kind = ACKED;
- notice.z_port = 0;
+ notice.z_port = __Zephyr_port;
notice.z_class = ZEPHYR_CTL_CLASS;
notice.z_class_inst = ZEPHYR_CTL_CLIENT;
notice.z_opcode = CLIENT_GIMMESUBS;
notice.z_sender = 0;
notice.z_recipient = "";
- notice.z_default_format = 0;
+ notice.z_default_format = "";
+ notice.z_num_other_fields = 0;
notice.z_message = asciiport;
+
if ((retval = ZMakeAscii(asciiport,sizeof(asciiport),
(unsigned char *)&port,
sizeof(u_short))) != ZERR_NONE)
@@ -61,8 +67,9 @@ Code_t ZRetrieveSubscriptions(port,nsubs)
while (!nrecv || !gimmeack) {
if ((retval = ZIfNotice(&retnotice,NULL,
- ZCompareUIDPred,
- (char *)&notice.z_uid)) != ZERR_NONE)
+ ZCompareMultiUIDPred,
+ (char *)&notice.z_multiuid))
+ != ZERR_NONE)
return (retval);
if (retnotice.z_kind == SERVNAK) {
@@ -76,8 +83,10 @@ Code_t ZRetrieveSubscriptions(port,nsubs)
continue;
}
- if (retnotice.z_kind != ACKED)
+ if (retnotice.z_kind != ACKED) {
+ ZFreeNotice(&retnotice);
return (ZERR_INTERNAL);
+ }
nrecv++;