FILE *fp, *newfp;
CtdlMakeTempFileName(tempfilename, sizeof tempfilename);
- if (sock_puts(*sock, "NDOP") < 0) return;
+ if (sock_puts(sock, "NDOP") < 0) return;
if (sock_getln(sock, buf, sizeof buf) < 0) return;
CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
bytes_received,
((download_len - bytes_received > IGNET_PACKET_SIZE)
? IGNET_PACKET_SIZE : (download_len - bytes_received)));
- if (sock_puts(*sock, buf) < 0) {
+ if (sock_puts(sock, buf) < 0) {
fclose(fp);
unlink(tempfilename);
return;
unlink(tempfilename);
return;
}
- if (sock_puts(*sock, "CLOS") < 0) {
+ if (sock_puts(sock, "CLOS") < 0) {
unlink(tempfilename);
return;
}
int fd;
char sfname[128];
- if (sock_puts(*sock, "NUOP") < 0) return;
+ if (sock_puts(sock, "NUOP") < 0) return;
if (sock_getln(sock, buf, sizeof buf) < 0) return;
CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
}
snprintf(buf, sizeof buf, "WRIT %ld", bytes_to_write);
- if (sock_puts(*sock, buf) < 0) {
+ if (sock_puts(sock, buf) < 0) {
close(fd);
return;
}
}
thisblock = atol(&buf[4]);
if (buf[0] == '7') {
- if (sock_write(*sock, pbuf,
+ if (sock_write(sock, pbuf,
(int) thisblock) < 0) {
close(fd);
return;
if(CtdlThreadCheckStop())
return;
- if (sock_puts(*sock, "UCLS 1") < 0) return;
+ if (sock_puts(sock, "UCLS 1") < 0) return;
/**
* From here on we must complete or messages will get lost
*/
/* We're talking to the correct node. Now identify ourselves. */
snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
- if (sock_puts(sock, buf) <0) goto bail;
+ if (sock_puts(&sock, buf) <0) goto bail;
if (sock_getln(&sock, buf, sizeof buf) < 0) goto bail;
CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (buf[0] != '2') goto bail;
transmit_spool(&sock, node);
}
- sock_puts(sock, "QUIT");
-bail: sock_close(sock);
+ sock_puts(&sock, "QUIT");
+bail:
+ if (sock != -1)
+ sock_close(sock);
network_talking_to(node, NTT_REMOVE);
}