regnpar = 1;
regcode = r->program;
regc(MAGIC);
- if (reg(0, &flags) == NULL)
+ if (reg(0, &flags) == NULL) {
+ free(r);
return(NULL);
+ }
/* Dig out information for optimizations. */
r->regstart = '\0'; /* Worst-case defaults. */
while (*fp != 0) {
if (*fp == '%' && memchr("sdu", fp[1], 3) != nil) {
if (fp > fp0) {
- if ((r= write(fd, fp0, (fp - fp0))) < 0) return -1;
+ if ((r= write(fd, fp0, (fp - fp0))) < 0) goto error;
len+= r;
}
fp++;
if (*fp == 's') {
char *s= va_arg(ap, char *);
- if ((r= write(fd, s, strlen(s))) < 0) return -1;
+ if ((r= write(fd, s, strlen(s))) < 0) goto error;
len+= r;
} else {
int d;
do *--p= '0' + (u % 10); while ((u /= 10) > 0);
if (d < 0) *--p= '-';
- if ((r= write(fd, p, (a + sizeof(a)) - p)) < 0) return -1;
+ if ((r= write(fd, p, (a + sizeof(a)) - p)) < 0) goto error;
len+= r;
}
}
fp++;
}
if (fp > fp0) {
- if ((r= write(fd, fp0, (fp - fp0))) < 0) return -1;
+ if ((r= write(fd, fp0, (fp - fp0))) < 0) goto error;
len+= r;
}
va_end(ap);
return len;
+error:
+ va_end(ap);
+ return -1;
}
fflush(stdout);
++attempts;
}
- while ((firstch=(readline(Rxtimeout)) != ACK) && attempts < RETRYMAX);
+ while ((firstch = readline(Rxtimeout)) != ACK &&
+ attempts < RETRYMAX);
if (attempts == RETRYMAX) {
zperr("No ACK on EOT");
return ERROR;