apps/graphics and netutils: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.
This commit is contained in:
parent
65899c99e6
commit
a50383db3d
@ -415,7 +415,7 @@ static int tiff_datetime(FAR char *timbuf, unsigned int buflen)
|
||||
ret = clock_gettime(CLOCK_REALTIME, &ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
gerr("clock_gettime failed: %d\n", errno);
|
||||
gerr("ERROR: clock_gettime failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -463,21 +463,24 @@ int tiff_initialize(FAR struct tiff_info_s *info)
|
||||
info->outfd = open(info->outfile, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
||||
if (info->outfd < 0)
|
||||
{
|
||||
gerr("Failed to open %s for reading/writing: %d\n", info->outfile, errno);
|
||||
gerr("ERROR: Failed to open %s for reading/writing: %d\n",
|
||||
info->outfile, errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
info->tmp1fd = open(info->tmpfile1, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
||||
if (info->tmp1fd < 0)
|
||||
{
|
||||
gerr("Failed to open %s for reading/writing: %d\n", info->tmpfile1, errno);
|
||||
gerr("ERROR: Failed to open %s for reading/writing: %d\n",
|
||||
info->tmpfile1, errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
info->tmp2fd = open(info->tmpfile2, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
||||
if (info->tmp2fd < 0)
|
||||
{
|
||||
gerr("Failed to open %s for reading/writing: %d\n", info->tmpfile2, errno);
|
||||
gerr("ERROR: Failed to open %s for reading/writing: %d\n",
|
||||
info->tmpfile2, errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -519,7 +522,7 @@ int tiff_initialize(FAR struct tiff_info_s *info)
|
||||
break;
|
||||
|
||||
default:
|
||||
gerr("Unsupported color format: %d\n", info->colorfmt);
|
||||
gerr("ERROR: Unsupported color format: %d\n", info->colorfmt);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -353,9 +353,9 @@ void *dhcpc_open(const void *macaddr, int maclen)
|
||||
struct timeval tv;
|
||||
int ret;
|
||||
|
||||
nerr("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
((uint8_t*)macaddr)[0], ((uint8_t*)macaddr)[1], ((uint8_t*)macaddr)[2],
|
||||
((uint8_t*)macaddr)[3], ((uint8_t*)macaddr)[4], ((uint8_t*)macaddr)[5]);
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
((uint8_t*)macaddr)[0], ((uint8_t*)macaddr)[1], ((uint8_t*)macaddr)[2],
|
||||
((uint8_t*)macaddr)[3], ((uint8_t*)macaddr)[4], ((uint8_t*)macaddr)[5]);
|
||||
|
||||
/* Allocate an internal DHCP structure */
|
||||
|
||||
@ -469,7 +469,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
{
|
||||
/* Send the DISCOVER command */
|
||||
|
||||
nerr("Broadcast DISCOVER\n");
|
||||
ninfo("Broadcast DISCOVER\n");
|
||||
if (dhcpc_sendmsg(pdhcpc, presult, DHCPDISCOVER) < 0)
|
||||
{
|
||||
return ERROR;
|
||||
@ -487,7 +487,8 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
* by a new OFFER.
|
||||
*/
|
||||
|
||||
nerr("Received OFFER from %08x\n", ntohl(presult->serverid.s_addr));
|
||||
ninfo("Received OFFER from %08x\n",
|
||||
ntohl(presult->serverid.s_addr));
|
||||
pdhcpc->ipaddr.s_addr = presult->ipaddr.s_addr;
|
||||
pdhcpc->serverid.s_addr = presult->serverid.s_addr;
|
||||
|
||||
@ -522,7 +523,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
{
|
||||
/* Send the REQUEST message to obtain the lease that was offered to us. */
|
||||
|
||||
nerr("Send REQUEST\n");
|
||||
ninfo("Send REQUEST\n");
|
||||
if (dhcpc_sendmsg(pdhcpc, presult, DHCPREQUEST) < 0)
|
||||
{
|
||||
return ERROR;
|
||||
@ -544,7 +545,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
|
||||
if (msgtype == DHCPACK)
|
||||
{
|
||||
nerr("Received ACK\n");
|
||||
ninfo("Received ACK\n");
|
||||
state = STATE_HAVE_LEASE;
|
||||
}
|
||||
|
||||
@ -554,7 +555,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
|
||||
else if (msgtype == DHCPNAK)
|
||||
{
|
||||
nerr("Received NAK\n");
|
||||
ninfo("Received NAK\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -565,7 +566,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
|
||||
else if (msgtype == DHCPOFFER)
|
||||
{
|
||||
nerr("Received another OFFER, send DECLINE\n");
|
||||
ninfo("Received another OFFER, send DECLINE\n");
|
||||
(void)dhcpc_sendmsg(pdhcpc, presult, DHCPDECLINE);
|
||||
}
|
||||
|
||||
@ -573,7 +574,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
|
||||
else
|
||||
{
|
||||
nerr("Ignoring msgtype=%d\n", msgtype);
|
||||
ninfo("Ignoring msgtype=%d\n", msgtype);
|
||||
}
|
||||
}
|
||||
|
||||
@ -595,26 +596,26 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
||||
}
|
||||
while (state != STATE_HAVE_LEASE);
|
||||
|
||||
nerr("Got IP address %d.%d.%d.%d\n",
|
||||
(presult->ipaddr.s_addr ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 8 ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 16 ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 24 ) & 0xff);
|
||||
nerr("Got netmask %d.%d.%d.%d\n",
|
||||
(presult->netmask.s_addr ) & 0xff,
|
||||
(presult->netmask.s_addr >> 8 ) & 0xff,
|
||||
(presult->netmask.s_addr >> 16 ) & 0xff,
|
||||
(presult->netmask.s_addr >> 24 ) & 0xff);
|
||||
nerr("Got DNS server %d.%d.%d.%d\n",
|
||||
(presult->dnsaddr.s_addr ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 8 ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 16 ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 24 ) & 0xff);
|
||||
nerr("Got default router %d.%d.%d.%d\n",
|
||||
(presult->default_router.s_addr ) & 0xff,
|
||||
(presult->default_router.s_addr >> 8 ) & 0xff,
|
||||
(presult->default_router.s_addr >> 16 ) & 0xff,
|
||||
(presult->default_router.s_addr >> 24 ) & 0xff);
|
||||
nerr("Lease expires in %d seconds\n", presult->lease_time);
|
||||
ninfo("Got IP address %d.%d.%d.%d\n",
|
||||
(presult->ipaddr.s_addr ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 8 ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 16 ) & 0xff,
|
||||
(presult->ipaddr.s_addr >> 24 ) & 0xff);
|
||||
ninfo("Got netmask %d.%d.%d.%d\n",
|
||||
(presult->netmask.s_addr ) & 0xff,
|
||||
(presult->netmask.s_addr >> 8 ) & 0xff,
|
||||
(presult->netmask.s_addr >> 16 ) & 0xff,
|
||||
(presult->netmask.s_addr >> 24 ) & 0xff);
|
||||
ninfo("Got DNS server %d.%d.%d.%d\n",
|
||||
(presult->dnsaddr.s_addr ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 8 ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 16 ) & 0xff,
|
||||
(presult->dnsaddr.s_addr >> 24 ) & 0xff);
|
||||
ninfo("Got default router %d.%d.%d.%d\n",
|
||||
(presult->default_router.s_addr ) & 0xff,
|
||||
(presult->default_router.s_addr >> 8 ) & 0xff,
|
||||
(presult->default_router.s_addr >> 16 ) & 0xff,
|
||||
(presult->default_router.s_addr >> 24 ) & 0xff);
|
||||
ninfo("Lease expires in %d seconds\n", presult->lease_time);
|
||||
return OK;
|
||||
}
|
||||
|
@ -495,7 +495,8 @@ static inline bool dhcpd_parseoptions(void)
|
||||
{
|
||||
/* Bad magic number... skip g_state.ds_outpacket */
|
||||
|
||||
nerr("Bad magic: %d,%d,%d,%d\n", ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
nerr("ERROR: Bad magic: %d,%d,%d,%d\n",
|
||||
ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -798,7 +799,7 @@ static inline int dhcpd_socket(void)
|
||||
sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -809,7 +810,7 @@ static inline int dhcpd_socket(void)
|
||||
ret = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SO_REUSEADDR failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_REUSEADDR failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -820,7 +821,7 @@ static inline int dhcpd_socket(void)
|
||||
ret = setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (void*)&optval, sizeof(int));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SO_BROADCAST failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_BROADCAST failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -847,7 +848,7 @@ static inline int dhcpd_openresponder(void)
|
||||
sockfd = dhcpd_socket();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -860,8 +861,8 @@ static inline int dhcpd_openresponder(void)
|
||||
ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
nerr("ERROR: bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -1159,7 +1160,7 @@ static inline int dhcpd_discover(void)
|
||||
{
|
||||
/* Nope... return failure */
|
||||
|
||||
nerr("Failed to get IP address\n");
|
||||
nerr("ERROR: Failed to get IP address\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -1167,7 +1168,7 @@ static inline int dhcpd_discover(void)
|
||||
|
||||
if (!dhcpd_setlease(g_state.ds_inpacket.chaddr, ipaddr, CONFIG_NETUTILS_DHCPD_OFFERTIME))
|
||||
{
|
||||
nerr("Failed to set lease\n");
|
||||
nerr("ERROR: Failed to set lease\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -1380,7 +1381,7 @@ static inline int dhcpd_openlistener(void)
|
||||
sockfd = dhcpd_socket();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -1390,7 +1391,7 @@ static inline int dhcpd_openlistener(void)
|
||||
ret = ioctl(sockfd, SIOCGIFADDR, (unsigned long)&req);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SIOCGIFADDR failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SIOCGIFADDR failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -1409,7 +1410,7 @@ static inline int dhcpd_openlistener(void)
|
||||
ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("bind failed, port=%d addr=%08lx: %d\n",
|
||||
nerr("ERROR: bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
@ -1449,7 +1450,7 @@ int dhcpd_run(void)
|
||||
sockfd = dhcpd_openlistener();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("Failed to create socket\n");
|
||||
nerr("ERROR: Failed to create socket\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1461,7 +1462,7 @@ int dhcpd_run(void)
|
||||
{
|
||||
/* On errors (other EINTR), close the socket and try again */
|
||||
|
||||
nerr("recv failed: %d\n", errno);
|
||||
nerr("ERROR: recv failed: %d\n", errno);
|
||||
if (errno != EINTR)
|
||||
{
|
||||
close(sockfd);
|
||||
@ -1476,7 +1477,7 @@ int dhcpd_run(void)
|
||||
{
|
||||
/* Failed to parse the message options */
|
||||
|
||||
nerr("No msg type\n");
|
||||
nerr("ERROR: No msg type\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1512,7 +1513,8 @@ int dhcpd_run(void)
|
||||
|
||||
case DHCPINFORM: /* Not supported */
|
||||
default:
|
||||
nerr("Unsupported message type: %d\n", g_state.ds_optmsgtype);
|
||||
nerr("ERROR: Unsupported message type: %d\n",
|
||||
g_state.ds_optmsgtype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ static int discover_daemon(int argc, char *argv[])
|
||||
sockfd = discover_openlistener();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("Failed to create socket\n");
|
||||
nerr("ERROR: Failed to create socket\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ static int discover_daemon(int argc, char *argv[])
|
||||
{
|
||||
/* On errors (other EINTR), close the socket and try again */
|
||||
|
||||
nerr("recv failed: %d\n", errno);
|
||||
nerr("ERROR: recv failed: %d\n", errno);
|
||||
if (errno != EINTR)
|
||||
{
|
||||
close(sockfd);
|
||||
@ -224,7 +224,7 @@ static int discover_daemon(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
nerr("Received discover from %08lx'\n", srcaddr.sin_addr.s_addr);
|
||||
ninfo("Received discover from %08lx'\n", srcaddr.sin_addr.s_addr);
|
||||
|
||||
discover_respond(&srcaddr.sin_addr.s_addr);
|
||||
}
|
||||
@ -239,13 +239,13 @@ static inline int discover_parse(request_t packet)
|
||||
|
||||
if (packet[0] != DISCOVER_PROTO_ID)
|
||||
{
|
||||
nerr("Wrong protocol id: %d\n", packet[0]);
|
||||
nerr("ERROR: Wrong protocol id: %d\n", packet[0]);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (packet[1] != DISCOVER_REQUEST)
|
||||
{
|
||||
nerr("Wrong command: %d\n", packet[1]);
|
||||
nerr("ERROR: Wrong command: %d\n", packet[1]);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ static inline int discover_parse(request_t packet)
|
||||
|
||||
if ((chk & 0xff) != packet[3])
|
||||
{
|
||||
nerr("Checksum does not match: %d\n", packet[3]);
|
||||
nerr("ERROR: Checksum does not match: %d\n", packet[3]);
|
||||
return ERROR;
|
||||
}
|
||||
else
|
||||
@ -276,7 +276,7 @@ static inline int discover_respond(in_addr_t *ipaddr)
|
||||
sockfd = discover_openresponder();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("discover_openresponder failed\n");
|
||||
nerr("ERROR: discover_openresponder failed\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ static inline int discover_respond(in_addr_t *ipaddr)
|
||||
(struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Could not send discovery response: %d\n", errno);
|
||||
nerr("ERROR: Could not send discovery response: %d\n", errno);
|
||||
}
|
||||
|
||||
close(sockfd);
|
||||
@ -311,7 +311,7 @@ static inline int discover_socket()
|
||||
sockfd = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ static inline int discover_socket()
|
||||
ret = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SO_REUSEADDR failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_REUSEADDR failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -333,7 +333,7 @@ static inline int discover_socket()
|
||||
ret = setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (void*)&optval, sizeof(int));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SO_BROADCAST failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_BROADCAST failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -354,7 +354,7 @@ static inline int discover_openlistener()
|
||||
sockfd = discover_socket();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ static inline int discover_openlistener()
|
||||
ret = ioctl(sockfd, SIOCGIFADDR, (unsigned long)&req);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt SIOCGIFADDR failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SIOCGIFADDR failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -382,8 +382,8 @@ static inline int discover_openlistener()
|
||||
ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
nerr("ERROR: bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -402,7 +402,7 @@ static inline int discover_openresponder(void)
|
||||
sockfd = discover_socket();
|
||||
if (sockfd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -415,8 +415,8 @@ static inline int discover_openresponder(void)
|
||||
ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
nerr("ERROR: bind failed, port=%d addr=%08lx: %d\n",
|
||||
addr.sin_port, (long)addr.sin_addr.s_addr, errno);
|
||||
close(sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
@ -457,7 +457,7 @@ int discover_start(struct discover_info_s *info)
|
||||
if (pid < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("Failed to start the discover daemon: %d\n", errval);
|
||||
nerr("ERROR: Failed to start the discover daemon: %d\n", errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
|
@ -182,20 +182,20 @@ static int lesp_set_baudrate(int baudrate)
|
||||
|
||||
if (ioctl(g_lesp_state.fd,TCGETS,(unsigned long)&term) < 0)
|
||||
{
|
||||
nerr("TCGETS failed.\n");
|
||||
nerr("ERROR: TCGETS failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((cfsetispeed(&term, baudrate) < 0) ||
|
||||
(cfsetospeed(&term, baudrate) < 0))
|
||||
{
|
||||
nerr("Connot set baudrate %0x08X\n",baudrate);
|
||||
nerr("ERROR: Connot set baudrate %0x08X\n",baudrate);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(g_lesp_state.fd,TCSETS,(unsigned long)&term) < 0)
|
||||
{
|
||||
nerr("TCSETS failed.\n");
|
||||
nerr("ERROR: TCSETS failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ static lesp_socket_t *get_sock(int sockfd)
|
||||
|
||||
if ((g_lesp_state.sockets[sockfd].flags & FLAGS_SOCK_USED) == 0)
|
||||
{
|
||||
nerr("Connection id %d not Created!\n", sockfd);
|
||||
nerr("ERROR: Connection id %d not Created!\n", sockfd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -271,12 +271,12 @@ static int lesp_low_level_read(uint8_t* buf, int size)
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
nerr("worker read Error %d (errno %d)\n", ret, errcode);
|
||||
nerr("ERROR: worker read Error %d (errno %d)\n", ret, errcode);
|
||||
UNUSED(errcode);
|
||||
}
|
||||
else if ((fds[0].revents & POLLERR) && (fds[0].revents & POLLHUP))
|
||||
{
|
||||
nerr("worker poll read Error %d\n", ret);
|
||||
nerr("ERROR: worker poll read Error %d\n", ret);
|
||||
ret = -1;
|
||||
}
|
||||
else if (fds[0].revents & POLLIN)
|
||||
@ -790,7 +790,7 @@ static void *lesp_worker(void *args)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("worker read data Error %d\n", ret);
|
||||
nerr("ERROR: worker read data Error %d\n", ret);
|
||||
}
|
||||
else if (ret > 0)
|
||||
{
|
||||
@ -850,7 +850,7 @@ static inline int lesp_create_worker(int priority)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Cannot Set scheduler parameter thread (%d)\n", ret);
|
||||
nerr("ERROR: Cannot Set scheduler parameter thread (%d)\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -862,7 +862,7 @@ static inline int lesp_create_worker(int priority)
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("Cannot Get/Set scheduler parameter thread (%d)\n", ret);
|
||||
nerr("ERROR: Cannot Get/Set scheduler parameter thread (%d)\n", ret);
|
||||
}
|
||||
|
||||
g_lesp_state.worker.running = true;
|
||||
@ -871,13 +871,13 @@ static inline int lesp_create_worker(int priority)
|
||||
(ret < 0)?NULL:&thread_attr, lesp_worker, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Cannot Create thread return (%d)\n", ret);
|
||||
nerr("ERROR: Cannot Create thread return (%d)\n", ret);
|
||||
g_lesp_state.worker.running = false;
|
||||
}
|
||||
|
||||
if (pthread_attr_destroy(&thread_attr) < 0)
|
||||
{
|
||||
nerr("Cannot destroy thread attribute (%d)\n", ret);
|
||||
nerr("ERROR: Cannot destroy thread attribute (%d)\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -919,14 +919,14 @@ int lesp_initialize(void)
|
||||
|
||||
if (g_lesp_state.fd < 0)
|
||||
{
|
||||
nerr("Cannot open %s\n", CONFIG_NETUTILS_ESP8266_DEV_PATH);
|
||||
nerr("ERROR: Cannot open %s\n", CONFIG_NETUTILS_ESP8266_DEV_PATH);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_TERMIOS
|
||||
if (ret >= 0 && lesp_set_baudrate(CONFIG_NETUTILS_ESP8266_BAUDRATE) < 0)
|
||||
{
|
||||
nerr("Cannot set baud rate %d\n", CONFIG_NETUTILS_ESP8266_BAUDRATE);
|
||||
nerr("ERROR: Cannot set baud rate %d\n", CONFIG_NETUTILS_ESP8266_BAUDRATE);
|
||||
ret = -1;
|
||||
}
|
||||
#endif
|
||||
@ -1020,7 +1020,7 @@ int lesp_ap_connect(const char* ssid_name, const char* ap_key, int timeout_s)
|
||||
|
||||
if (! g_lesp_state.is_initialized)
|
||||
{
|
||||
nerr("ESP8266 not initialized; can't run manual connect\n");
|
||||
nerr("ERROR: ESP8266 not initialized; can't run manual connect\n");
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
@ -1167,7 +1167,7 @@ int lesp_list_access_points(lesp_cb_t cb)
|
||||
ret = lesp_parse_cwlap_ans_line(g_lesp_state.bufans,&ap);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Line badly formed.");
|
||||
nerr("ERROR: Line badly formed.");
|
||||
}
|
||||
|
||||
cb(&ap);
|
||||
@ -1210,7 +1210,7 @@ int lesp_socket(int domain, int type, int protocol)
|
||||
|
||||
if ((domain != PF_INET) && (type != SOCK_STREAM) && (IPPROTO_TCP))
|
||||
{
|
||||
nerr("Not Implemented!\n");
|
||||
nerr("ERROR: Not Implemented!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1272,7 +1272,7 @@ int lesp_closesocket(int sockfd)
|
||||
|
||||
int lesp_bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1322,13 +1322,13 @@ int lesp_connect(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen)
|
||||
|
||||
int lesp_listen(int sockfd, int backlog)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lesp_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1385,7 +1385,7 @@ ssize_t lesp_send(int sockfd, FAR const uint8_t *buf, size_t len, int flags)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Cannot send in socket %d, %d bytes\n", sockfd, len);
|
||||
nerr("ERROR: Cannot send in socket %d, %d bytes\n", sockfd, len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1475,28 +1475,28 @@ ssize_t lesp_recv(int sockfd, FAR uint8_t *buf, size_t len, int flags)
|
||||
int lesp_setsockopt(int sockfd, int level, int option,
|
||||
FAR const void *value, socklen_t value_len)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lesp_getsockopt(int sockfd, int level, int option, FAR void *value,
|
||||
FAR socklen_t *value_len)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lesp_gethostbyname(char *hostname, uint16_t usNameLen,
|
||||
unsigned long *out_ip_addr)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lesp_mdnsadvertiser(uint16_t mdnsEnabled, char *deviceServiceName,
|
||||
uint16_t deviceServiceNameLength)
|
||||
{
|
||||
nerr("Not implemented %s\n", __func__);
|
||||
nerr("ERROR: Not implemented %s\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ int ftpc_chmod(SESSION handle, FAR const char *path, FAR const char *mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("Server does not support SITE CHMOD\n");
|
||||
nwarn("WARNING: Server does not support SITE CHMOD\n");
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
|
@ -136,7 +136,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
|
||||
if (!ftpc_sockconnected(&session->cmd))
|
||||
{
|
||||
nerr("Cmd channel si not connected\n");
|
||||
nwarn("WARNING: Cmd channel is not connected\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Error sending cmd %s: %d\n", cmd, errno);
|
||||
nerr("ERROR: Error sending cmd %s: %d\n", cmd, errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
ret = fptc_getreply(session);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Error getting reply: %d\n", errno);
|
||||
nerr("ERROR: Error getting reply: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
{
|
||||
/* Server is closing the control connection. */
|
||||
|
||||
nerr("Server closed control connection\n");
|
||||
nwarn("WARNING: Server closed control connection\n");
|
||||
|
||||
/* If we were previously logged in and this is not a QUIT commnad
|
||||
* then attempt to automatically reconnect to the server.
|
||||
@ -196,7 +196,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
|
||||
if (reconnect)
|
||||
{
|
||||
nerr("Reconnect failed\n");
|
||||
nwarn("WARNING: Reconnect failed\n");
|
||||
goto errout;
|
||||
}
|
||||
else
|
||||
@ -205,12 +205,12 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
||||
* continue the loop and try to send the command again.
|
||||
*/
|
||||
|
||||
nerr("Reconnecting...\n");
|
||||
ninfo("Reconnecting...\n");
|
||||
reconnect = true;
|
||||
ret = ftpc_restore();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Failed to restore the connection");
|
||||
nwarn("WARNING: Failed to restore the connection");
|
||||
goto errout;
|
||||
}
|
||||
continue;
|
||||
|
@ -73,7 +73,7 @@ SESSION ftpc_connect(FAR struct ftpc_connect_s *server)
|
||||
session = (struct ftpc_session_s *)zalloc(sizeof(struct ftpc_session_s));
|
||||
if (!session)
|
||||
{
|
||||
nerr("Failed to allocate a session\n");
|
||||
nerr("ERROR: Failed to allocate a session\n");
|
||||
set_errno(ENOMEM);
|
||||
goto errout;
|
||||
}
|
||||
@ -116,7 +116,7 @@ SESSION ftpc_connect(FAR struct ftpc_connect_s *server)
|
||||
ret = ftpc_reconnect(session);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_reconnect() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_reconnect() failed: %d\n", errno);
|
||||
goto errout_with_alloc;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
||||
ret = wd_start(session->wdog, session->conntimeo, ftpc_timeout, 1, session);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("wd_start() failed\n");
|
||||
nerr("ERROR: wd_start() failed\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_sockinit(&session->cmd);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_sockinit() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockinit() failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -172,7 +172,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
||||
|
||||
#ifdef CONFIG_DEBUG_NET_ERROR
|
||||
tmp = inet_ntoa(session->addr);
|
||||
nerr("Connecting to server address %s:%d\n", tmp, ntohs(session->port));
|
||||
ninfo("Connecting to server address %s:%d\n",
|
||||
tmp, ntohs(session->port));
|
||||
#endif
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
@ -182,7 +183,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_sockconnect(&session->cmd, &addr);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_sockconnect() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockconnect() failed: %d\n", errno);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
@ -217,11 +218,11 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_NET_ERROR
|
||||
nerr("Connected\n");
|
||||
ninfo("Connected\n");
|
||||
tmp = inet_ntoa(addr.sin_addr);
|
||||
nerr(" Remote address: %s:%d\n", tmp, ntohs(addr.sin_port));
|
||||
ninfo(" Remote address: %s:%d\n", tmp, ntohs(addr.sin_port));
|
||||
tmp = inet_ntoa(session->cmd.laddr.sin_addr);
|
||||
nerr(" Local address: %s:%d\n", tmp, ntohs(session->cmd.laddr.sin_port));
|
||||
ninfo(" Local address: %s:%d\n", tmp, ntohs(session->cmd.laddr.sin_port));
|
||||
#endif
|
||||
return OK;
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int ftpc_recvinit(struct ftpc_session_s *session, FAR const char *path,
|
||||
ret = ftpc_cmd(session, "REST %ld", offset);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("REST command failed: %d\n", errno);
|
||||
nwarn("WARNING: REST command failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ static int ftpc_recvinit(struct ftpc_session_s *session, FAR const char *path,
|
||||
ret = ftpc_cmd(session, "RETR %s", path);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("RETR command failed: %d\n", errno);
|
||||
nwarn("WARNING: RETR command failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ static int ftpc_recvinit(struct ftpc_session_s *session, FAR const char *path,
|
||||
ret = ftpc_sockaccept(&session->data);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("Data connection not accepted\n");
|
||||
nerr("ERROR: Data connection not accepted\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname,
|
||||
abslpath = ftpc_abslpath(session, lname);
|
||||
if (!abslpath)
|
||||
{
|
||||
nerr("ftpc_abslpath(%s) failed: %d\n", errno);
|
||||
nwarn("WARNING: ftpc_abslpath(%s) failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname,
|
||||
|
||||
if (S_ISDIR(statbuf.st_mode))
|
||||
{
|
||||
nerr("'%s' is a directory\n", abslpath);
|
||||
nwarn("WARNING: '%s' is a directory\n", abslpath);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,7 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname,
|
||||
#ifdef S_IWRITE
|
||||
if (!(statbuf.st_mode & S_IWRITE))
|
||||
{
|
||||
nerr("'%s' permission denied\n", abslpath);
|
||||
nwarn("WARNING: '%s' permission denied\n", abslpath);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
#endif
|
||||
@ -308,14 +308,14 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname,
|
||||
ret = ftpc_recvinit(session, rname, xfrmode, offset);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_recvinit failed\n");
|
||||
nerr("ERROR: ftpc_recvinit failed\n");
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
|
||||
loutstream = fopen(abslpath, (offset > 0 || (how == FTPC_GET_APPEND)) ? "a" : "w");
|
||||
if (!loutstream)
|
||||
{
|
||||
nerr("fopen failed: %d\n", errno);
|
||||
nerr("ERROR: fopen failed: %d\n", errno);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname,
|
||||
ret = fseek(loutstream, offset, SEEK_SET);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("fseek failed: %d\n", errno);
|
||||
nerr("ERROR: fseek failed: %d\n", errno);
|
||||
goto errout_with_outstream;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
|
||||
|
||||
if (!ftpc_sockconnected(&session->cmd))
|
||||
{
|
||||
nerr("Cmd channel disconnected\n");
|
||||
nwarn("WARNING: Cmd channel disconnected\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
|
||||
|
||||
if (ch == EOF)
|
||||
{
|
||||
nerr("EOF: Server closed command stream\n");
|
||||
nwarn("WARNING: EOF: Server closed command stream\n");
|
||||
ftpc_reset(session);
|
||||
return ERROR;
|
||||
}
|
||||
@ -189,7 +189,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("Reply truncated\n");
|
||||
nwarn("WARNING: Reply truncated\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ int ftpc_idle(SESSION handle, unsigned int idletime)
|
||||
|
||||
if (!FTPC_HAS_IDLE(session))
|
||||
{
|
||||
nerr("Server does not support SITE IDLE\n");
|
||||
nwarn("WARNING: Server does not support SITE IDLE\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ int ftpc_idle(SESSION handle, unsigned int idletime)
|
||||
{
|
||||
/* Server does not support SITE IDLE */
|
||||
|
||||
nerr("Server does not support SITE IDLE\n");
|
||||
nwarn("WARNING: Server does not support SITE IDLE\n");
|
||||
FTPC_CLR_IDLE(session);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ static int ftpc_recvdir(FAR struct ftpc_session_s *session,
|
||||
|
||||
if (!ftpc_connected(session))
|
||||
{
|
||||
nerr("Not connected to server\n");
|
||||
nerr("ERROR: Not connected to server\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ static int ftpc_recvdir(FAR struct ftpc_session_s *session,
|
||||
ret = ftpc_sockaccept(&session->data);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_sockaccept() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockaccept() failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle,
|
||||
filestream = fopen(tmpfname, "w+");
|
||||
if (!filestream)
|
||||
{
|
||||
nerr("Failed to create %s: %d\n", tmpfname, errno);
|
||||
nerr("ERROR: Failed to create %s: %d\n", tmpfname, errno);
|
||||
free(absrpath);
|
||||
free(tmpfname);
|
||||
return NULL;
|
||||
@ -312,7 +312,7 @@ FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle,
|
||||
ret = ftpc_cmd(session, "CWD %s", absrpath);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("CWD to %s failed\n", absrpath);
|
||||
nerr("ERROR: CWD to %s failed\n", absrpath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle,
|
||||
int tmpret = ftpc_cmd(session, "CWD %s", session->currdir);
|
||||
if (tmpret != OK)
|
||||
{
|
||||
nerr("CWD back to to %s failed\n", session->currdir);
|
||||
nerr("ERROR: CWD back to to %s failed\n", session->currdir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle,
|
||||
ftpc_nlstparse(filestream, ftpc_dircount, &nnames);
|
||||
if (!nnames)
|
||||
{
|
||||
nerr("Nothing found in directory\n");
|
||||
nwarn("WARNING: Nothing found in directory\n");
|
||||
goto errout;
|
||||
}
|
||||
ninfo("nnames: %d\n", nnames);
|
||||
@ -357,7 +357,7 @@ FAR struct ftpc_dirlist_s *ftpc_listdir(SESSION handle,
|
||||
dirlist = (struct ftpc_dirlist_s *)malloc(allocsize);
|
||||
if (!dirlist)
|
||||
{
|
||||
nerr("Failed to allocate dirlist\n");
|
||||
nerr("ERROR: Failed to allocate dirlist\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
||||
|
||||
if (!ftpc_connected(session))
|
||||
{
|
||||
nerr("Not connected\n");
|
||||
nerr("ERROR: Not connected\n");
|
||||
errcode = ENOTCONN;
|
||||
goto errout_with_err;
|
||||
}
|
||||
@ -98,7 +98,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
||||
|
||||
if (ftpc_loggedin(session))
|
||||
{
|
||||
nerr("Already logged in\n");
|
||||
nerr("ERROR: Already logged in\n");
|
||||
errcode = EINVAL;
|
||||
goto errout_with_err;
|
||||
}
|
||||
@ -123,7 +123,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
||||
ret = ftpc_relogin(session);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("login failed: %d\n", errno);
|
||||
nerr("ERROR: login failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ int ftpc_relogin(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_cmd(session, "USER %s", session->uname);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("USER %s cmd failed: %d\n", session->uname, errno);
|
||||
nerr("ERROR: USER %s cmd failed: %d\n", session->uname, errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ int ftpc_relogin(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_cmd(session, "PASS %s", session->pwd);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("PASS %s cmd failed: %d\n", session->pwd, errno);
|
||||
nerr("ERROR: PASS %s cmd failed: %d\n", session->pwd, errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ static int ftpc_sendfile(struct ftpc_session_s *session, const char *path,
|
||||
ret = ftpc_sockaccept(&session->data);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("Data connection not accepted\n");
|
||||
nerr("ERROR: Data connection not accepted\n");
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@ -400,7 +400,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
abslpath = ftpc_abslpath(session, lname);
|
||||
if (!abslpath)
|
||||
{
|
||||
nerr("ftpc_abslpath(%s) failed: %d\n", errno);
|
||||
nwarn("WARNING: ftpc_abslpath(%s) failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
ret = stat(abslpath, &statbuf);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("stat(%s) failed: %d\n", errno);
|
||||
nwarn("WARNING: stat(%s) failed: %d\n", errno);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
|
||||
if (S_ISDIR(statbuf.st_mode))
|
||||
{
|
||||
nerr("%s is a directory\n", abslpath);
|
||||
nwarn("WARNING: %s is a directory\n", abslpath);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
finstream = fopen(abslpath, "r");
|
||||
if (!finstream)
|
||||
{
|
||||
nerr("fopen() failed: %d\n", errno);
|
||||
nwarn("WARNING: fopen() failed: %d\n", errno);
|
||||
goto errout_with_abspath;
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
session->offset = ftpc_filesize(session, rname);
|
||||
if (session->offset == (off_t)ERROR)
|
||||
{
|
||||
nerr("Failed to get size of remote file: %s\n", rname);
|
||||
nwarn("WARNING: Failed to get size of remote file: %s\n", rname);
|
||||
goto errout_with_instream;
|
||||
}
|
||||
else
|
||||
@ -454,7 +454,7 @@ int ftp_putfile(SESSION handle, const char *lname, const char *rname,
|
||||
ret = fseek(finstream, session->offset, SEEK_SET);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("fseek failed: %d\n", errno);
|
||||
nerr("ERROR: fseek failed: %d\n", errno);
|
||||
goto errout_with_instream;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
||||
start = strchr(session->reply, '\"');
|
||||
if (!start)
|
||||
{
|
||||
nerr("Opening quote not found\n");
|
||||
nwarn("WARNING: Opening quote not found\n");
|
||||
return NULL;
|
||||
}
|
||||
start++;
|
||||
@ -108,7 +108,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
||||
end = strchr(start, '\"');
|
||||
if (!end)
|
||||
{
|
||||
nerr("Closing quote not found\n");
|
||||
nwarn("WARNING: Closing quote not found\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
||||
pwd = (char *)malloc(len + 1);
|
||||
if (!pwd)
|
||||
{
|
||||
nerr("Failed to allocate string\n");
|
||||
nerr("ERROR: Failed to allocate string\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ int ftpc_sockinit(FAR struct ftpc_socket_s *sock)
|
||||
sock->sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (sock->sd < 0)
|
||||
{
|
||||
nerr("socket() failed: %d\n", errno);
|
||||
nerr("ERROR: socket() failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ int ftpc_sockinit(FAR struct ftpc_socket_s *sock)
|
||||
sock->instream = fdopen(sock->sd, "r");
|
||||
if (!sock->instream)
|
||||
{
|
||||
nerr("fdopen() failed: %d\n", errno);
|
||||
nerr("ERROR: fdopen() failed: %d\n", errno);
|
||||
goto errout_with_sd;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ int ftpc_sockinit(FAR struct ftpc_socket_s *sock)
|
||||
sock->outstream = fdopen(sock->sd, "w");
|
||||
if (!sock->outstream)
|
||||
{
|
||||
nerr("fdopen() failed: %d\n", errno);
|
||||
nerr("ERROR: fdopen() failed: %d\n", errno);
|
||||
goto errout_with_instream;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ int ftpc_sockconnect(struct ftpc_socket_s *sock, struct sockaddr_in *addr)
|
||||
ret = connect(sock->sd, (struct sockaddr *)addr, sizeof(struct sockaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("connect() failed: %d\n", errno);
|
||||
nerr("ERROR: connect() failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ int ftpc_sockconnect(struct ftpc_socket_s *sock, struct sockaddr_in *addr)
|
||||
ret = ftpc_sockgetsockname(sock, &sock->laddr);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpc_sockgetsockname() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockgetsockname() failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ int ftpc_sockaccept(FAR struct ftpc_socket_s *sock)
|
||||
sock->sd = accept(sock->sd, &addr, &addrlen);
|
||||
if (sock->sd == -1)
|
||||
{
|
||||
nerr("accept() failed: %d\n", errno);
|
||||
nerr("ERROR: accept() failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ int ftpc_sockaccept(FAR struct ftpc_socket_s *sock)
|
||||
sock->instream = fdopen(sock->sd, "r");
|
||||
if (!sock->instream)
|
||||
{
|
||||
nerr("fdopen() failed: %d\n", errno);
|
||||
nerr("ERROR: fdopen() failed: %d\n", errno);
|
||||
goto errout_with_sd;
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ int ftpc_sockaccept(FAR struct ftpc_socket_s *sock)
|
||||
sock->outstream = fdopen(sock->sd, "w");
|
||||
if (!sock->outstream)
|
||||
{
|
||||
nerr("fdopen() failed: %d\n", errno);
|
||||
nerr("ERROR: fdopen() failed: %d\n", errno);
|
||||
goto errout_with_instream;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ int ftpc_socklisten(struct ftpc_socket_s *sock)
|
||||
ret = bind(sock->sd, (struct sockaddr *)&sock->laddr, addrlen);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("bind() failed: %d\n", errno);
|
||||
nerr("ERROR: bind() failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ int ftpc_sockgetsockname(FAR struct ftpc_socket_s *sock,
|
||||
ret = getsockname(sock->sd, (FAR struct sockaddr *)addr, &len);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("getsockname failed: %d\n", errno);
|
||||
nerr("ERROR: getsockname failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
|
@ -111,7 +111,7 @@ static int ftp_pasvmode(struct ftpc_session_s *session,
|
||||
|
||||
if (!FTPC_HAS_PASV(session))
|
||||
{
|
||||
nerr("Host doesn't support passive mode\n");
|
||||
nwarn("WARNING: Host doesn't support passive mode\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ static int ftp_pasvmode(struct ftpc_session_s *session,
|
||||
&tmpap[3], &tmpap[4], &tmpap[5]);
|
||||
if (nscan != 6)
|
||||
{
|
||||
nerr("Error parsing PASV reply: '%s'\n", session->reply);
|
||||
nwarn("WARNING: Error parsing PASV reply: '%s'\n", session->reply);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
||||
|
||||
if (!ftpc_connected(session))
|
||||
{
|
||||
nerr("Not connected\n");
|
||||
nerr("ERROR: Not connected\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_sockinit(&session->data);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftpc_sockinit() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockinit() failed: %d\n", errno);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
||||
ret = ftp_pasvmode(session, addrport);
|
||||
if (ret != OK)
|
||||
{
|
||||
nerr("ftp_pasvmode() failed: %d\n", errno);
|
||||
nerr("ERROR: ftp_pasvmode() failed: %d\n", errno);
|
||||
goto errout_with_data;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
||||
ret = ftpc_sockconnect(&session->data, &addr);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpc_sockconnect() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_sockconnect() failed: %d\n", errno);
|
||||
goto errout_with_data;
|
||||
}
|
||||
}
|
||||
@ -316,7 +316,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
||||
paddr[3], pport[0], pport[1]);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpc_cmd() failed: %d\n", errno);
|
||||
nerr("ERROR: ftpc_cmd() failed: %d\n", errno);
|
||||
goto errout_with_data;
|
||||
}
|
||||
}
|
||||
@ -475,7 +475,7 @@ void ftpc_timeout(int argc, uint32_t arg1, ...)
|
||||
{
|
||||
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)arg1;
|
||||
|
||||
nllerr("Timeout!\n");
|
||||
nllerr("ERROR: Timeout!\n");
|
||||
DEBUGASSERT(argc == 1 && session);
|
||||
kill(session->pid, CONFIG_FTP_SIGNAL);
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ static FAR struct ftpd_account_s *ftpd_account_new(FAR const char *user,
|
||||
ret = (struct ftpd_account_s *)zalloc(allocsize);
|
||||
if (!ret)
|
||||
{
|
||||
nerr("Failed to allocate account\n");
|
||||
nerr("ERROR: Failed to allocate account\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ static int ftpd_accept(int sd, FAR void *addr, FAR socklen_t *addrlen,
|
||||
#ifdef CONFIG_DEBUG_NET
|
||||
if (ret != -ETIMEDOUT)
|
||||
{
|
||||
nerr("ftpd_rxpoll() failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_rxpoll() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
@ -888,7 +888,7 @@ static int ftpd_accept(int sd, FAR void *addr, FAR socklen_t *addrlen,
|
||||
if (acceptsd < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("accept() failed: %d\n", errval);
|
||||
nerr("ERROR: accept() failed: %d\n", errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ static ssize_t ftpd_recv(int sd, FAR void *data, size_t size, int timeout)
|
||||
{
|
||||
int errval = errno;
|
||||
|
||||
nerr("recv() failed: %d\n", errval);
|
||||
nerr("ERROR: recv() failed: %d\n", errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
@ -959,7 +959,7 @@ static ssize_t ftpd_send(int sd, FAR const void *data, size_t size, int timeout)
|
||||
if (ret < 0)
|
||||
{
|
||||
ssize_t errval = errno;
|
||||
nerr("send() failed: %d\n", errval);
|
||||
nerr("ERROR: send() failed: %d\n", errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
@ -1020,7 +1020,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session)
|
||||
if (session->data.sd < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("socket() failed: %d\n", errval);
|
||||
nerr("ERROR: socket() failed: %d\n", errval);
|
||||
(void)ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 451, ' ', "Socket error !");
|
||||
return -errval;
|
||||
@ -1032,7 +1032,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session)
|
||||
if (ret < 0)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("connect() failed: %d\n", errval);
|
||||
nerr("ERROR: connect() failed: %d\n", errval);
|
||||
(void)ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 451, ' ', "Connect error !");
|
||||
(void)ftpd_dataclose(session);
|
||||
@ -1060,7 +1060,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session)
|
||||
&session->data.addrlen, -1);
|
||||
if (sd < 0)
|
||||
{
|
||||
nerr("ftpd_accept() failed: %d\n", sd);
|
||||
nerr("ERROR: ftpd_accept() failed: %d\n", sd);
|
||||
(void)ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 451, ' ', "Accept error !");
|
||||
(void)ftpd_dataclose(session);
|
||||
@ -1121,7 +1121,7 @@ static FAR struct ftpd_server_s *ftpd_openserver(int port)
|
||||
server = (FAR struct ftpd_server_s *)zalloc(sizeof(struct ftpd_server_s));
|
||||
if (!server)
|
||||
{
|
||||
nerr("Failed to allocate server\n");
|
||||
nerr("ERROR: Failed to allocate server\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1660,7 +1660,7 @@ static off_t ftpd_offsatoi(FAR const char *filename, off_t offset)
|
||||
if (!outstream)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("Failed to open %s: %d\n", filename, errval);
|
||||
nerr("ERROR: Failed to open %s: %d\n", filename, errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
@ -1820,7 +1820,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
seekpos = ftpd_offsatoi(path, session->restartpos);
|
||||
if (seekpos < 0)
|
||||
{
|
||||
nerr("ftpd_offsatoi failed: %d\n", seekpos);
|
||||
nerr("ERROR: ftpd_offsatoi failed: %d\n", seekpos);
|
||||
errval = -seekpos;
|
||||
}
|
||||
}
|
||||
@ -1829,7 +1829,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
seekpos = session->restartpos;
|
||||
if (seekpos < 0)
|
||||
{
|
||||
nerr("Bad restartpos: %d\n", seekpos);
|
||||
nerr("ERROR: Bad restartpos: %d\n", seekpos);
|
||||
errval = EINVAL;
|
||||
}
|
||||
}
|
||||
@ -1842,7 +1842,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
if (seekoffs < 0)
|
||||
{
|
||||
errval = errno;
|
||||
nerr("lseek failed: %d\n", errval);
|
||||
nerr("ERROR: lseek failed: %d\n", errval);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1867,7 +1867,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
g_respfmt1, 150, ' ', "Opening data connection");
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_response failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_response failed: %d\n", ret);
|
||||
goto errout_with_session;
|
||||
}
|
||||
|
||||
@ -1916,7 +1916,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
|
||||
if (rdbytes < 0)
|
||||
{
|
||||
nerr("Read failed: rdbytes=%d errval=%d\n", rdbytes, errval);
|
||||
nerr("ERROR: Read failed: rdbytes=%d errval=%d\n", rdbytes, errval);
|
||||
(void)ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 550, ' ', "Data read error !");
|
||||
ret = -errval;
|
||||
@ -1971,7 +1971,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
if (wrbytes < 0)
|
||||
{
|
||||
errval = -wrbytes;
|
||||
nerr("ftpd_send failed: %d\n", errval);
|
||||
nerr("ERROR: ftpd_send failed: %d\n", errval);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1982,7 +1982,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
if (wrbytes < 0)
|
||||
{
|
||||
errval = errno;
|
||||
nerr("write() failed: %d\n", errval);
|
||||
nerr("ERROR: write() failed: %d\n", errval);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1994,7 +1994,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
||||
|
||||
if (wrbytes != ((ssize_t)buflen))
|
||||
{
|
||||
nerr("Write failed: wrbytes=%d errval=%d\n", wrbytes, errval);
|
||||
nerr("ERROR: Write failed: wrbytes=%d errval=%d\n", wrbytes, errval);
|
||||
(void)ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 550, ' ', "Data send error !");
|
||||
ret = -errval;
|
||||
@ -2332,7 +2332,7 @@ static int fptd_listscan(FAR struct ftpd_session_s *session, FAR char *path,
|
||||
if (!dir)
|
||||
{
|
||||
int errval = errno;
|
||||
nerr("dir() failed\n", errval);
|
||||
nerr("ERROR: dir() failed\n", errval);
|
||||
return -errval;
|
||||
}
|
||||
|
||||
@ -2684,7 +2684,7 @@ static int ftpd_command_port(FAR struct ftpd_session_s *session)
|
||||
"Illegal PORT command");
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_response failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_response failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -2863,7 +2863,7 @@ static int ftpd_command_eprt(FAR struct ftpd_session_s *session)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
nerr("Unrecognized family: %d\n", family);
|
||||
nerr("ERROR: Unrecognized family: %d\n", family);
|
||||
family = AF_UNSPEC;
|
||||
}
|
||||
|
||||
@ -3132,7 +3132,7 @@ static int ftpd_command_pasv(FAR struct ftpd_session_s *session)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
nerr("Unsupported family\n");
|
||||
nerr("ERROR: Unsupported family\n");
|
||||
}
|
||||
|
||||
session->data.addr.in4.sin_port = 0;
|
||||
@ -3890,7 +3890,7 @@ static int ftpd_startworker(pthread_startroutine_t handler, FAR void *arg,
|
||||
ret = pthread_attr_init(&attr);
|
||||
if (ret != 0)
|
||||
{
|
||||
nerr("pthread_attr_init() failed: %d\n", ret);
|
||||
nerr("ERROR: pthread_attr_init() failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@ -3899,7 +3899,7 @@ static int ftpd_startworker(pthread_startroutine_t handler, FAR void *arg,
|
||||
ret = pthread_attr_setstacksize(&attr, stacksize);
|
||||
if (ret != 0)
|
||||
{
|
||||
nerr("pthread_attr_setstacksize() failed: %d\n", ret);
|
||||
nerr("ERROR: pthread_attr_setstacksize() failed: %d\n", ret);
|
||||
goto errout_with_attr;
|
||||
}
|
||||
|
||||
@ -3908,7 +3908,7 @@ static int ftpd_startworker(pthread_startroutine_t handler, FAR void *arg,
|
||||
ret = pthread_create(&threadid, &attr, handler, arg);
|
||||
if (ret != 0)
|
||||
{
|
||||
nerr("pthread_create() failed: %d\n", ret);
|
||||
nerr("ERROR: pthread_create() failed: %d\n", ret);
|
||||
goto errout_with_attr;
|
||||
}
|
||||
|
||||
@ -3917,7 +3917,7 @@ static int ftpd_startworker(pthread_startroutine_t handler, FAR void *arg,
|
||||
ret = pthread_detach(threadid);
|
||||
if (ret != 0)
|
||||
{
|
||||
nerr("pthread_detach() failed: %d\n", ret);
|
||||
nerr("ERROR: pthread_detach() failed: %d\n", ret);
|
||||
}
|
||||
|
||||
errout_with_attr:
|
||||
@ -4035,7 +4035,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
||||
g_respfmt1, 220, ' ', CONFIG_FTPD_SERVERID);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_response() failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_response() failed: %d\n", ret);
|
||||
ftpd_freesession(session);
|
||||
return NULL;
|
||||
}
|
||||
@ -4126,7 +4126,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
||||
ret = ftpd_command(session);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("Disconnected by the command handler: %d\n", ret);
|
||||
nerr("ERROR: Disconnected by the command handler: %d\n", ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4203,7 +4203,7 @@ int ftpd_adduser(FTPD_SESSION handle, uint8_t accountflags,
|
||||
newaccount = ftpd_account_new(user, accountflags);
|
||||
if (!newaccount)
|
||||
{
|
||||
nerr("Failed to allocte memory to the account\n");
|
||||
nerr("ERROR: Failed to allocte memory to the account\n");
|
||||
ret = -ENOMEM;
|
||||
goto errout;
|
||||
}
|
||||
@ -4211,14 +4211,14 @@ int ftpd_adduser(FTPD_SESSION handle, uint8_t accountflags,
|
||||
ret = ftpd_account_setpassword(newaccount, passwd);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_account_setpassword failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_account_setpassword failed: %d\n", ret);
|
||||
goto errout_with_account;
|
||||
}
|
||||
|
||||
ret = ftpd_account_sethome(newaccount, home);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_account_sethome failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_account_sethome failed: %d\n", ret);
|
||||
goto errout_with_account;
|
||||
}
|
||||
|
||||
@ -4226,7 +4226,7 @@ int ftpd_adduser(FTPD_SESSION handle, uint8_t accountflags,
|
||||
ret = ftpd_account_add(server, newaccount);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_account_add failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_account_add failed: %d\n", ret);
|
||||
goto errout_with_account;
|
||||
}
|
||||
|
||||
@ -4276,7 +4276,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
||||
session = (FAR struct ftpd_session_s *)zalloc(sizeof(struct ftpd_session_s));
|
||||
if (!session)
|
||||
{
|
||||
nerr("Failed to allocate session\n");
|
||||
nerr("ERROR: Failed to allocate session\n");
|
||||
ret = -ENOMEM;
|
||||
goto errout;
|
||||
}
|
||||
@ -4312,7 +4312,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
||||
session->cmd.buffer = (FAR char *)malloc(session->cmd.buflen);
|
||||
if (!session->cmd.buffer)
|
||||
{
|
||||
nerr("Failed to allocate command buffer\n");
|
||||
nerr("ERROR: Failed to allocate command buffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_session;
|
||||
}
|
||||
@ -4322,7 +4322,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
||||
session->data.buffer = (FAR char *)malloc(session->data.buflen);
|
||||
if (!session->data.buffer)
|
||||
{
|
||||
nerr("Failed to allocate data buffer\n");
|
||||
nerr("ERROR: Failed to allocate data buffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_session;
|
||||
}
|
||||
@ -4338,7 +4338,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
||||
#ifdef CONFIG_DEBUG_NET
|
||||
if (session->cmd.sd != -ETIMEDOUT)
|
||||
{
|
||||
nerr("ftpd_accept() failed: %d\n", session->cmd.sd);
|
||||
nerr("ERROR: ftpd_accept() failed: %d\n", session->cmd.sd);
|
||||
}
|
||||
#endif
|
||||
ret = session->cmd.sd;
|
||||
@ -4351,7 +4351,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
||||
CONFIG_FTPD_WORKERSTACKSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ftpd_startworker() failed: %d\n", ret);
|
||||
nerr("ERROR: ftpd_startworker() failed: %d\n", ret);
|
||||
goto errout_with_session;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ int netlib_listenon(uint16_t portno)
|
||||
listensd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (listensd < 0)
|
||||
{
|
||||
nerr("socket failure: %d\n", errno);
|
||||
nerr("ERROR: socket failure: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ int netlib_listenon(uint16_t portno)
|
||||
optval = 1;
|
||||
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
|
||||
{
|
||||
nerr("setsockopt SO_REUSEADDR failure: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
#endif
|
||||
@ -110,7 +110,7 @@ int netlib_listenon(uint16_t portno)
|
||||
|
||||
if (bind(listensd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0)
|
||||
{
|
||||
nerr("bind failure: %d\n", errno);
|
||||
nerr("ERROR: bind failure: %d\n", errno);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ int netlib_listenon(uint16_t portno)
|
||||
|
||||
if (listen(listensd, 5) < 0)
|
||||
{
|
||||
nerr("listen failure %d\n", errno);
|
||||
nerr("ERROR: listen failure %d\n", errno);
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
|
||||
acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen);
|
||||
if (acceptsd < 0)
|
||||
{
|
||||
nerr("accept failure: %d\n", errno);
|
||||
nerr("ERROR: accept failure: %d\n", errno);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
|
||||
if (ret < 0)
|
||||
{
|
||||
close(acceptsd);
|
||||
nerr("setsockopt SO_LINGER failure: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_LINGER failure: %d\n", errno);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -145,7 +145,7 @@ void netlib_server(uint16_t portno, pthread_startroutine_t handler, int stacksiz
|
||||
/* Close the connection */
|
||||
|
||||
close(acceptsd);
|
||||
nerr("pthread_create failed\n");
|
||||
nerr("ERROR: pthread_create failed\n");
|
||||
|
||||
if (ret == EAGAIN)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ static inline ssize_t tftp_write(int fd, const uint8_t *buf, size_t len)
|
||||
|
||||
if (nbyteswritten < 0)
|
||||
{
|
||||
nerr("write failed: %d\n", errno);
|
||||
nerr("ERROR: write failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr,
|
||||
packet = (FAR uint8_t*)zalloc(TFTP_IOBUFSIZE);
|
||||
if (!packet)
|
||||
{
|
||||
nerr("packet memory allocation failure\n");
|
||||
nerr("ERROR: packet memory allocation failure\n");
|
||||
set_errno(ENOMEM);
|
||||
goto errout;
|
||||
}
|
||||
@ -179,7 +179,7 @@ int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr,
|
||||
fd = open(local, O_WRONLY|O_CREAT|O_TRUNC, 0666);
|
||||
if (fd < 0)
|
||||
{
|
||||
nerr("open failed: %d\n", errno);
|
||||
nerr("ERROR: open failed: %d\n", errno);
|
||||
goto errout_with_packet;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr)
|
||||
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (sd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr)
|
||||
ret = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(struct timeval));
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("setsockopt failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt failed: %d\n", errno);
|
||||
}
|
||||
|
||||
/* Initialize the server address structure */
|
||||
@ -262,7 +262,7 @@ ssize_t tftp_recvfrom(int sd, void *buf, size_t len, struct sockaddr_in *from)
|
||||
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
nerr("recvfrom timed out\n");
|
||||
nerr("ERROR: recvfrom timed out\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ ssize_t tftp_recvfrom(int sd, void *buf, size_t len, struct sockaddr_in *from)
|
||||
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
nerr("recvfrom failed: %d\n", errno);
|
||||
nerr("ERROR: recvfrom failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to)
|
||||
|
||||
if (errno != EINTR)
|
||||
{
|
||||
nerr("sendto failed: %d\n", errno);
|
||||
nerr("ERROR: sendto failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ static inline ssize_t tftp_read(int fd, uint8_t *buf, size_t buflen)
|
||||
|
||||
if (nbytesread < 0)
|
||||
{
|
||||
nerr("read failed: %d\n", errno);
|
||||
nerr("ERROR: read failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ int tftp_mkdatapacket(int fd, off_t offset, uint8_t *packet, uint16_t blockno)
|
||||
tmp = lseek(fd, offset, SEEK_SET);
|
||||
if (tmp == (off_t)-1)
|
||||
{
|
||||
nerr("lseek failed: %d\n", errno);
|
||||
nerr("ERROR: lseek failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -218,15 +218,15 @@ static int tftp_rcvack(int sd, uint8_t *packet, struct sockaddr_in *server,
|
||||
|
||||
if (nbytes == 0)
|
||||
{
|
||||
nerr("Connection lost: %d bytes\n", nbytes);
|
||||
nerr("ERROR: Connection lost: %d bytes\n", nbytes);
|
||||
}
|
||||
else if (nbytes > 0)
|
||||
{
|
||||
nerr("Short packet: %d bytes\n", nbytes);
|
||||
nerr("ERROR: Short packet: %d bytes\n", nbytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("Recveid failure\n");
|
||||
nerr("ERROR: Recvfrom failure\n");
|
||||
}
|
||||
|
||||
/* Break out to bump up the retry count */
|
||||
@ -301,7 +301,7 @@ static int tftp_rcvack(int sd, uint8_t *packet, struct sockaddr_in *server,
|
||||
|
||||
/* We have tried TFTP_RETRIES times */
|
||||
|
||||
nerr("Timeout, Waiting for ACK\n");
|
||||
nerr("ERROR: Timeout, Waiting for ACK\n");
|
||||
return ERROR; /* Will never get here */
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary)
|
||||
packet = (uint8_t*)zalloc(TFTP_IOBUFSIZE);
|
||||
if (!packet)
|
||||
{
|
||||
nerr("packet memory allocation failure\n");
|
||||
nerr("ERROR: packet memory allocation failure\n");
|
||||
set_errno(ENOMEM);
|
||||
goto errout;
|
||||
}
|
||||
@ -351,7 +351,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary)
|
||||
fd = open(local, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
nerr("open failed: %d\n", errno);
|
||||
nerr("ERROR: open failed: %d\n", errno);
|
||||
goto errout_with_packet;
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary)
|
||||
break;
|
||||
}
|
||||
|
||||
nerr("Re-sending request\n");
|
||||
nwarn("WARNING: Re-sending request\n");
|
||||
|
||||
/* We are going to loop and re-send the request packet. Check the
|
||||
* retry count so that we do not loop forever.
|
||||
@ -395,7 +395,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary)
|
||||
|
||||
if (++retry > TFTP_RETRIES)
|
||||
{
|
||||
nerr("Retry count exceeded\n");
|
||||
nerr("ERROR: Retry count exceeded\n");
|
||||
set_errno(ETIMEDOUT);
|
||||
goto errout_with_sd;
|
||||
}
|
||||
@ -462,7 +462,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary)
|
||||
|
||||
if (++retry > TFTP_RETRIES)
|
||||
{
|
||||
nerr("Retry count exceeded\n");
|
||||
nerr("ERROR: Retry count exceeded\n");
|
||||
set_errno(ETIMEDOUT);
|
||||
goto errout_with_sd;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
|
||||
#ifdef CONFIG_DEBUG_FEATURES_FEATURES
|
||||
if (!sockaddr_check(saP))
|
||||
{
|
||||
nerr("unknown sockaddr family on listen socket\n");
|
||||
nerr("ERROR: unknown sockaddr family on listen socket\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@ -235,7 +235,7 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
|
||||
listen_fd = socket(saP->sin_family, SOCK_STREAM, 0);
|
||||
if (listen_fd < 0)
|
||||
{
|
||||
nerr("socket failed: %d\n", errno);
|
||||
nerr("ERROR: socket failed: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -244,14 +244,14 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
|
||||
on = 1;
|
||||
if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
|
||||
{
|
||||
nerr("setsockopt(SO_REUSEADDR) failed: %d\n", errno);
|
||||
nerr("ERROR: setsockopt(SO_REUSEADDR) failed: %d\n", errno);
|
||||
}
|
||||
|
||||
/* Bind to it. */
|
||||
|
||||
if (bind(listen_fd, (struct sockaddr*)saP, sockaddr_len(saP)) < 0)
|
||||
{
|
||||
nerr("bind to %s failed: %d\n", httpd_ntoa(saP), errno);
|
||||
nerr("ERROR: bind to %s failed: %d\n", httpd_ntoa(saP), errno);
|
||||
(void)close(listen_fd);
|
||||
return -1;
|
||||
}
|
||||
@ -261,14 +261,14 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
|
||||
flags = fcntl(listen_fd, F_GETFL, 0);
|
||||
if (flags == -1)
|
||||
{
|
||||
nerr("fcntl(F_GETFL) failed: %d\n", errno);
|
||||
nerr("ERROR: fcntl(F_GETFL) failed: %d\n", errno);
|
||||
(void)close(listen_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fcntl(listen_fd, F_SETFL, flags | O_NDELAY) < 0)
|
||||
{
|
||||
nerr("fcntl(O_NDELAY) failed: %d\n", errno);
|
||||
nerr("ERROR: fcntl(O_NDELAY) failed: %d\n", errno);
|
||||
(void)close(listen_fd);
|
||||
return -1;
|
||||
}
|
||||
@ -277,7 +277,7 @@ static int initialize_listen_socket(httpd_sockaddr *saP)
|
||||
|
||||
if (listen(listen_fd, CONFIG_THTTPD_LISTEN_BACKLOG) < 0)
|
||||
{
|
||||
nerr("listen failed: %d\n", errno);
|
||||
nerr("ERROR: listen failed: %d\n", errno);
|
||||
(void)close(listen_fd);
|
||||
return -1;
|
||||
}
|
||||
@ -297,7 +297,8 @@ static void add_response(httpd_conn *hc, const char *str)
|
||||
|
||||
if (resplen > CONFIG_THTTPD_IOBUFFERSIZE)
|
||||
{
|
||||
nerr("resplen(%d) > buffer size(%d)\n", resplen, CONFIG_THTTPD_IOBUFFERSIZE);
|
||||
nwarn("WARNING: resplen(%d) > buffer size(%d)\n",
|
||||
resplen, CONFIG_THTTPD_IOBUFFERSIZE);
|
||||
resplen = CONFIG_THTTPD_IOBUFFERSIZE;
|
||||
len = resplen - hc->buflen;
|
||||
}
|
||||
@ -733,6 +734,7 @@ static int auth_check2(httpd_conn *hc, char *dirname)
|
||||
send_authenticate(hc, dirname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*authpass++ = '\0';
|
||||
|
||||
/* If there are more fields, cut them off. */
|
||||
@ -776,8 +778,8 @@ static int auth_check2(httpd_conn *hc, char *dirname)
|
||||
{
|
||||
/* The file exists but we can't open it? Disallow access. */
|
||||
|
||||
nerr("%s auth file %s could not be opened: %d\n",
|
||||
httpd_ntoa(&hc->client_addr), authpath, errno);
|
||||
nerr("ERROR: %s auth file %s could not be opened: %d\n",
|
||||
httpd_ntoa(&hc->client_addr), authpath, errno);
|
||||
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
@ -1009,7 +1011,7 @@ static int vhost_map(httpd_conn *hc)
|
||||
sz = sizeof(sa);
|
||||
if (getsockname(hc->conn_fd, &sa.sa, &sz) < 0)
|
||||
{
|
||||
nerr("getsockname: %d\n", errno);
|
||||
nerr("ERROR: getsockname: %d\n", errno);
|
||||
return 0;
|
||||
}
|
||||
hc->vhostname = httpd_ntoa(&sa);
|
||||
@ -1588,7 +1590,7 @@ static void ls_child(int argc, char **argv)
|
||||
fp = fdopen(hc->conn_fd, "w");
|
||||
if (fp == NULL)
|
||||
{
|
||||
nerr("fdopen: %d\n", errno);
|
||||
nerr("ERROR: fdopen: %d\n", errno);
|
||||
INTERNALERROR("fdopen");
|
||||
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
|
||||
httpd_write_response(hc);
|
||||
@ -1630,7 +1632,7 @@ static void ls_child(int argc, char **argv)
|
||||
|
||||
if (!names || !nameptrs)
|
||||
{
|
||||
nerr("out of memory reallocating directory names\n");
|
||||
nerr("ERROR: out of memory reallocating directory names\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1817,7 +1819,7 @@ static int ls(httpd_conn *hc)
|
||||
dirp = opendir(hc->expnfilename);
|
||||
if (dirp == NULL)
|
||||
{
|
||||
nerr("opendir %s: %d\n", hc->expnfilename, errno);
|
||||
nerr("ERROR: opendir %s: %d\n", hc->expnfilename, errno);
|
||||
httpd_send_err(hc, 404, err404title, "", err404form, hc->encodedurl);
|
||||
return -1;
|
||||
}
|
||||
@ -1851,7 +1853,7 @@ static int ls(httpd_conn *hc)
|
||||
(main_t)ls_child, (FAR char * const *)argv);
|
||||
if (child < 0)
|
||||
{
|
||||
nerr("task_create: %d\n", errno);
|
||||
nerr("ERROR: task_create: %d\n", errno);
|
||||
closedir(dirp);
|
||||
INTERNALERROR("task_create");
|
||||
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
|
||||
@ -1859,7 +1861,8 @@ static int ls(httpd_conn *hc)
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
nerr("spawned indexing task %d for directory '%s'\n", child, hc->expnfilename);
|
||||
nerr("ERROR: spawned indexing task %d for directory '%s'\n",
|
||||
child, hc->expnfilename);
|
||||
|
||||
/* Schedule a kill for the child task, in case it runs too long */
|
||||
|
||||
@ -1867,7 +1870,7 @@ static int ls(httpd_conn *hc)
|
||||
client_data.i = child;
|
||||
if (tmr_create(NULL, cgi_kill, client_data, CONFIG_THTTPD_CGI_TIMELIMIT * 1000L, 0) == NULL)
|
||||
{
|
||||
nerr("tmr_create(cgi_kill ls) failed\n");
|
||||
nerr("ERROR: tmr_create(cgi_kill ls) failed\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
@ -1918,8 +1921,8 @@ static int check_referer(httpd_conn *hc)
|
||||
cp = "";
|
||||
}
|
||||
|
||||
nerr("%s non-local referer \"%s%s\" \"%s\"\n",
|
||||
httpd_ntoa(&hc->client_addr), cp, hc->encodedurl, hc->referer);
|
||||
ninfo("%s non-local referer \"%s%s\" \"%s\"\n",
|
||||
httpd_ntoa(&hc->client_addr), cp, hc->encodedurl, hc->referer);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"You must supply a local referer to get URL '%s' from this server.\n"),
|
||||
@ -2092,7 +2095,7 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa)
|
||||
hs = (FAR httpd_server *)zalloc(sizeof(httpd_server));
|
||||
if (!hs)
|
||||
{
|
||||
nerr("out of memory allocating an httpd_server\n");
|
||||
nerr("ERROR: out of memory allocating an httpd_server\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2105,7 +2108,7 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa)
|
||||
|
||||
if (!hs->hostname)
|
||||
{
|
||||
nerr("out of memory copying hostname\n");
|
||||
nerr("ERROR: out of memory copying hostname\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2116,7 +2119,7 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa)
|
||||
hs->listen_fd = initialize_listen_socket(sa);
|
||||
if (hs->listen_fd == -1)
|
||||
{
|
||||
nerr("Failed to create listen socket\n");
|
||||
nerr("ERROR: Failed to create listen socket\n");
|
||||
free_httpd_server(hs);
|
||||
return NULL;
|
||||
}
|
||||
@ -2125,7 +2128,7 @@ FAR httpd_server *httpd_initialize(FAR httpd_sockaddr *sa)
|
||||
|
||||
/* Done initializing. */
|
||||
|
||||
nerr("%s starting on port %d\n", CONFIG_THTTPD_SERVER_SOFTWARE, (int)CONFIG_THTTPD_PORT);
|
||||
ninfo("%s starting on port %d\n", CONFIG_THTTPD_SERVER_SOFTWARE, (int)CONFIG_THTTPD_PORT);
|
||||
return hs;
|
||||
}
|
||||
|
||||
@ -2204,7 +2207,7 @@ void httpd_send_err(httpd_conn *hc, int status, const char *title, const char *e
|
||||
|
||||
/* Try virtual host error page. */
|
||||
|
||||
nerr("title: \"%s\" form: \"%s\"\n", title, form);
|
||||
ninfo("title: \"%s\" form: \"%s\"\n", title, form);
|
||||
|
||||
#ifdef CONFIG_THTTPD_VHOST
|
||||
if (hc->hostdir[0] != '\0')
|
||||
@ -2303,14 +2306,14 @@ int httpd_get_conn(httpd_server *hs, int listen_fd, httpd_conn *hc)
|
||||
return GC_NO_MORE;
|
||||
}
|
||||
|
||||
nerr("accept failed: %d\n", errno);
|
||||
nerr("ERROR: accept failed: %d\n", errno);
|
||||
return GC_FAIL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FEATURES_FEATURES
|
||||
if (!sockaddr_check(&sa))
|
||||
{
|
||||
nerr("unknown sockaddr family\n");
|
||||
nerr("ERROR: unknown sockaddr family\n");
|
||||
close(hc->conn_fd);
|
||||
hc->conn_fd = -1;
|
||||
return GC_FAIL;
|
||||
@ -2788,8 +2791,8 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
{
|
||||
if (strlen(hc->accept) > CONFIG_THTTPD_MAXREALLOC)
|
||||
{
|
||||
nerr("%s way too much Accept: data\n",
|
||||
httpd_ntoa(&hc->client_addr));
|
||||
nerr("ERROR: %s way too much Accept: data\n",
|
||||
httpd_ntoa(&hc->client_addr));
|
||||
continue;
|
||||
}
|
||||
httpd_realloc_str(&hc->accept, &hc->maxaccept, strlen(hc->accept) + 2 + strlen(cp));
|
||||
@ -2809,8 +2812,8 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
{
|
||||
if (strlen(hc->accepte) > CONFIG_THTTPD_MAXREALLOC)
|
||||
{
|
||||
nerr("%s way too much Accept-Encoding: data\n",
|
||||
httpd_ntoa(&hc->client_addr));
|
||||
nerr("ERROR: %s way too much Accept-Encoding: data\n",
|
||||
httpd_ntoa(&hc->client_addr));
|
||||
continue;
|
||||
}
|
||||
httpd_realloc_str(&hc->accepte, &hc->maxaccepte, strlen(hc->accepte) + 2 + strlen(cp));
|
||||
@ -2833,7 +2836,9 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
cp = &buf[18];
|
||||
hc->if_modified_since = tdate_parse(cp);
|
||||
if (hc->if_modified_since == (time_t) - 1)
|
||||
nerr("unparsable time: %s\n", cp);
|
||||
{
|
||||
nerr("ERROR: unparsable time: %s\n", cp);
|
||||
}
|
||||
}
|
||||
else if (strncasecmp(buf, "Cookie:", 7) == 0)
|
||||
{
|
||||
@ -2878,7 +2883,7 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
hc->range_if = tdate_parse(cp);
|
||||
if (hc->range_if == (time_t) - 1)
|
||||
{
|
||||
nerr("unparsable time: %s\n", cp);
|
||||
nerr("ERROR: unparsable time: %s\n", cp);
|
||||
}
|
||||
}
|
||||
else if (strncasecmp(buf, "Content-Type:", 13) == 0)
|
||||
@ -2940,7 +2945,7 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
; /* ignore */
|
||||
else
|
||||
{
|
||||
nerr("unknown request header: %s\n", buf);
|
||||
nwarn("WARNING: unknown request header: %s\n", buf);
|
||||
}
|
||||
#endif /* LOG_UNKNOWN_HEADERS */
|
||||
}
|
||||
@ -3058,7 +3063,7 @@ int httpd_parse_request(httpd_conn *hc)
|
||||
#endif
|
||||
else
|
||||
{
|
||||
nerr("%s URL \"%s\" goes outside the web tree\n",
|
||||
nwarn("WARNING: %s URL \"%s\" goes outside the web tree\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
@ -3152,8 +3157,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
|
||||
if (!(hc->sb.st_mode & (S_IROTH | S_IXOTH)))
|
||||
{
|
||||
nerr("%s URL \"%s\" resolves to a non world-readable file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" resolves to a non world-readable file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' resolves to a file that is not world-readable.\n"),
|
||||
@ -3218,8 +3223,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
|
||||
if (!(hc->sb.st_mode & S_IROTH))
|
||||
{
|
||||
nerr("%s URL \"%s\" tried to index a non-readable directory\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" tried to index a non-readable directory\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' resolves to a directory that has indexing disabled.\n"),
|
||||
@ -3248,8 +3253,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
#else /* CONFIG_THTTPD_GENERATE_INDICES */
|
||||
/* Indexing is disabled */
|
||||
|
||||
nerr("%s URL \"%s\" tried to index a directory with indexing disabled\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" tried to index a directory with indexing disabled\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' is a directory, and directory indexing is disabled on this server.\n"),
|
||||
@ -3279,8 +3284,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
|
||||
if (!(hc->sb.st_mode & (S_IROTH | S_IXOTH)))
|
||||
{
|
||||
nerr("%s URL \"%s\" resolves to a non-world-readable index file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" resolves to a non-world-readable index file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' resolves to an index file that is not world-readable.\n"),
|
||||
@ -3315,8 +3320,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
{
|
||||
if (strcmp(hc->expnfilename, CONFIG_THTTPD_AUTH_FILE) == 0)
|
||||
{
|
||||
nerr("%s URL \"%s\" tried to retrieve an auth file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" tried to retrieve an auth file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' is an authorization file, retrieving it is not permitted.\n"),
|
||||
@ -3329,8 +3334,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
CONFIG_THTTPD_AUTH_FILE) == 0 &&
|
||||
hc->expnfilename[expnlen - sizeof(CONFIG_THTTPD_AUTH_FILE)] == '/')
|
||||
{
|
||||
nerr("%s URL \"%s\" tried to retrieve an auth file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" tried to retrieve an auth file\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' is an authorization file, retrieving it is not permitted.\n"),
|
||||
@ -3360,8 +3365,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
|
||||
if (hc->sb.st_mode & S_IXOTH)
|
||||
{
|
||||
nerr("%s URL \"%s\" is executable but isn't CGI\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" is executable but isn't CGI\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.\n"),
|
||||
@ -3371,8 +3376,8 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
||||
|
||||
if (hc->pathinfo[0] != '\0')
|
||||
{
|
||||
nerr("%s URL \"%s\" has pathinfo but isn't CGI\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
nwarn("WARNING: %s URL \"%s\" has pathinfo but isn't CGI\n",
|
||||
httpd_ntoa(&hc->client_addr), hc->encodedurl);
|
||||
httpd_send_err(hc, 403, err403title, "",
|
||||
ERROR_FORM(err403form,
|
||||
"The requested URL '%s' resolves to a file plus CGI-style pathinfo, but the file is not a valid CGI file.\n"),
|
||||
@ -3465,7 +3470,7 @@ int httpd_read(int fd, const void *buf, size_t nbytes)
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
nerr("Error sending: %d\n", errno);
|
||||
nerr("ERROR: Error sending: %d\n", errno);
|
||||
return nread;
|
||||
}
|
||||
}
|
||||
@ -3497,7 +3502,7 @@ int httpd_write(int fd, const void *buf, size_t nbytes)
|
||||
}
|
||||
else if (errno != EINTR)
|
||||
{
|
||||
nerr("Error sending: %d\n", errno);
|
||||
nerr("ERROR: Error sending: %d\n", errno);
|
||||
return nwritten;
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static int handle_newconnect(FAR struct timeval *tv, int listen_fd)
|
||||
* back here.
|
||||
*/
|
||||
|
||||
nerr("No free connections\n");
|
||||
nerr("ERROR: No free connections\n");
|
||||
tmr_run(tv);
|
||||
return -1;
|
||||
}
|
||||
@ -206,7 +206,7 @@ static int handle_newconnect(FAR struct timeval *tv, int listen_fd)
|
||||
conn->hc = NEW(httpd_conn, 1);
|
||||
if (conn->hc == NULL)
|
||||
{
|
||||
nerr("out of memory allocating an httpd_conn\n");
|
||||
nerr("ERROR: out of memory allocating an httpd_conn\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ static void handle_read(struct connect_s *conn, struct timeval *tv)
|
||||
return;
|
||||
}
|
||||
|
||||
nerr("read(fd=%d) failed: %d\n", hc->conn_fd, errno);
|
||||
nerr("ERROR: read(fd=%d) failed: %d\n", hc->conn_fd, errno);
|
||||
BADREQUEST("read");
|
||||
goto errout_with_400;
|
||||
}
|
||||
@ -372,7 +372,8 @@ static void handle_read(struct connect_s *conn, struct timeval *tv)
|
||||
actual = lseek(hc->file_fd, conn->offset, SEEK_SET);
|
||||
if (actual != conn->offset)
|
||||
{
|
||||
nerr("fseek to %d failed: offset=%d errno=%d\n", conn->offset, actual, errno);
|
||||
nerr("ERROR: fseek to %d failed: offset=%d errno=%d\n",
|
||||
conn->offset, actual, errno);
|
||||
BADREQUEST("lseek");
|
||||
goto errout_with_400;
|
||||
}
|
||||
@ -434,7 +435,7 @@ static void handle_send(struct connect_s *conn, struct timeval *tv)
|
||||
nread = read_buffer(conn);
|
||||
if (nread < 0)
|
||||
{
|
||||
nerr("File read error: %d\n", errno);
|
||||
nerr("ERROR: File read error: %d\n", errno);
|
||||
goto errout_clear_connection;
|
||||
}
|
||||
ninfo("Read %d bytes, buflen %d\n", nread, hc->buflen);
|
||||
@ -450,7 +451,8 @@ static void handle_send(struct connect_s *conn, struct timeval *tv)
|
||||
nwritten = httpd_write(hc->conn_fd, hc->buffer, hc->buflen);
|
||||
if (nwritten < 0)
|
||||
{
|
||||
nerr("Error sending %s: %d\n", hc->encodedurl, errno);
|
||||
nerr("ERROR: Error sending %s: %d\n",
|
||||
hc->encodedurl, errno);
|
||||
goto errout_clear_connection;
|
||||
}
|
||||
|
||||
@ -476,7 +478,7 @@ static void handle_send(struct connect_s *conn, struct timeval *tv)
|
||||
return;
|
||||
|
||||
errout_clear_connection:
|
||||
nerr("Clear connection\n");
|
||||
ninfo("Clear connection\n");
|
||||
clear_connection(conn, tv);
|
||||
return;
|
||||
}
|
||||
@ -556,7 +558,8 @@ static void clear_connection(struct connect_s *conn, struct timeval *tv)
|
||||
{
|
||||
return;
|
||||
}
|
||||
nerr("tmr_create(linger_clear_connection) failed\n");
|
||||
|
||||
nerr("ERROR: tmr_create(linger_clear_connection) failed\n");
|
||||
}
|
||||
|
||||
/* Either we are done lingering, we shouldn't linger, or we failed to setup the linger */
|
||||
@ -594,7 +597,8 @@ static void idle(ClientData client_data, struct timeval *nowP)
|
||||
case CNST_READING:
|
||||
if (nowP->tv_sec - conn->active_at >= CONFIG_THTTPD_IDLE_READ_LIMIT_SEC)
|
||||
{
|
||||
nerr("%s connection timed out reading\n", httpd_ntoa(&conn->hc->client_addr));
|
||||
nerr("ERROR: %s connection timed out reading\n",
|
||||
httpd_ntoa(&conn->hc->client_addr));
|
||||
httpd_send_err(conn->hc, 408, httpd_err408title, "",
|
||||
httpd_err408form, "");
|
||||
finish_connection(conn, nowP);
|
||||
@ -604,7 +608,8 @@ static void idle(ClientData client_data, struct timeval *nowP)
|
||||
case CNST_SENDING:
|
||||
if (nowP->tv_sec - conn->active_at >= CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC)
|
||||
{
|
||||
nerr("%s connection timed out sending\n", httpd_ntoa(&conn->hc->client_addr));
|
||||
nerr("ERROR: %s connection timed out sending\n",
|
||||
httpd_ntoa(&conn->hc->client_addr));
|
||||
clear_connection(conn, nowP);
|
||||
}
|
||||
break;
|
||||
@ -682,7 +687,7 @@ int thttpd_main(int argc, char **argv)
|
||||
fw = fdwatch_initialize(CONFIG_NSOCKET_DESCRIPTORS);
|
||||
if (!fw)
|
||||
{
|
||||
nerr("fdwatch initialization failure\n");
|
||||
nerr("ERROR: fdwatch initialization failure\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -691,7 +696,8 @@ int thttpd_main(int argc, char **argv)
|
||||
#ifdef CONFIG_THTTPD_DATADIR
|
||||
if (chdir(CONFIG_THTTPD_DATADIR) < 0)
|
||||
{
|
||||
nerr("chdir to %s: %d\n", CONFIG_THTTPD_DATADIR, errno);
|
||||
ninfo("chdir to %s: %d\n",
|
||||
CONFIG_THTTPD_DATADIR, errno);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
@ -706,7 +712,7 @@ int thttpd_main(int argc, char **argv)
|
||||
hs = httpd_initialize(&sa);
|
||||
if (!hs)
|
||||
{
|
||||
nerr("httpd_initialize() failed\n");
|
||||
nerr("ERROR: httpd_initialize() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -714,7 +720,7 @@ int thttpd_main(int argc, char **argv)
|
||||
|
||||
if (tmr_create(NULL, occasional, JunkClientData, CONFIG_THTTPD_OCCASIONAL_MSEC * 1000L, 1) == NULL)
|
||||
{
|
||||
nerr("tmr_create(occasional) failed\n");
|
||||
nerr("ERROR: tmr_create(occasional) failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -722,7 +728,7 @@ int thttpd_main(int argc, char **argv)
|
||||
|
||||
if (tmr_create(NULL, idle, JunkClientData, 5 * 1000L, 1) == NULL)
|
||||
{
|
||||
nerr("tmr_create(idle) failed\n");
|
||||
nerr("ERROR: tmr_create(idle) failed\n");
|
||||
exit(1);
|
||||
|
||||
}
|
||||
@ -732,7 +738,7 @@ int thttpd_main(int argc, char **argv)
|
||||
connects = NEW(struct connect_s, AVAILABLE_FDS);
|
||||
if (connects == NULL)
|
||||
{
|
||||
nerr("Out of memory allocating a struct connect_s\n");
|
||||
nerr("ERROR: Out of memory allocating a struct connect_s\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -772,7 +778,7 @@ int thttpd_main(int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
|
||||
nerr("fdwatch failed: %d\n", errno);
|
||||
nerr("ERROR: fdwatch failed: %d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -855,7 +861,7 @@ int thttpd_main(int argc, char **argv)
|
||||
/* The main loop terminated */
|
||||
|
||||
shut_down();
|
||||
nerr("Exiting\n");
|
||||
ninfo("Exiting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,8 @@ void httpd_memstats(void)
|
||||
{
|
||||
static struct mallinfo mm;
|
||||
|
||||
nerr("%d allocations (%lu bytes), %d freed\n", g_nallocations, (unsigned long)g_allocated, g_nfreed);
|
||||
ninfo("%d allocations (%lu bytes), %d freed\n",
|
||||
g_nallocations, (unsigned long)g_allocated, g_nfreed);
|
||||
|
||||
/* Get the current memory usage */
|
||||
|
||||
@ -91,7 +92,7 @@ void httpd_memstats(void)
|
||||
#else
|
||||
(void)mallinfo(&mm);
|
||||
#endif
|
||||
nerr("arena: %08x ordblks: %08x mxordblk: %08x uordblks: %08x fordblks: %08x\n",
|
||||
ninfo("arena: %08x ordblks: %08x mxordblk: %08x uordblks: %08x fordblks: %08x\n",
|
||||
mm.arena, mm.ordblks, mm.mxordblk, mm.uordblks, mm.fordblks);
|
||||
}
|
||||
#endif
|
||||
@ -106,7 +107,7 @@ FAR void *httpd_malloc(size_t nbytes)
|
||||
void *ptr = malloc(nbytes);
|
||||
if (!ptr)
|
||||
{
|
||||
nerr("Allocation of %d bytes failed\n", nbytes);
|
||||
nerr("ERROR: Allocation of %d bytes failed\n", nbytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -125,7 +126,7 @@ FAR void *httpd_realloc(FAR void *oldptr, size_t oldsize, size_t newsize)
|
||||
void *ptr = realloc(oldptr, newsize);
|
||||
if (!ptr)
|
||||
{
|
||||
nerr("Re-allocation from %d to %d bytes failed\n",
|
||||
nerr("ERROR: Re-allocation from %d to %d bytes failed\n",
|
||||
oldsize, newsize);
|
||||
}
|
||||
else
|
||||
@ -155,7 +156,7 @@ FAR char *httpd_strdup(const char *str)
|
||||
FAR char *newstr = strdup(str);
|
||||
if (!newstr)
|
||||
{
|
||||
nerr("strdup of %s failed\n", str);
|
||||
nerr("ERROR: strdup of %s failed\n", str);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -191,7 +192,8 @@ void httpd_realloc_str(char **pstr, size_t *maxsize, size_t size)
|
||||
|
||||
if (!*pstr)
|
||||
{
|
||||
nerr("out of memory reallocating a string to %d bytes\n", *maxsize);
|
||||
nerr("ERROR: out of memory reallocating a string to %d bytes\n",
|
||||
*maxsize);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ static inline int cgi_interpose_input(struct cgi_conn_s *cc)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
nllerr("read failed: %d\n", errno);
|
||||
nllerr("ERROR: read failed: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -391,7 +391,7 @@ static inline int cgi_interpose_input(struct cgi_conn_s *cc)
|
||||
nllinfo("nbytes_written: %d\n", nbytes_written);
|
||||
if (nbytes_written != nbytes_read)
|
||||
{
|
||||
nllerr("httpd_write failed\n");
|
||||
nllerr("ERROR: httpd_write failed\n");
|
||||
return 1;
|
||||
}
|
||||
cgi_dumpbuffer("Sent to CGI:", cc->inbuf.buffer, nbytes_written);
|
||||
@ -469,7 +469,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc)
|
||||
{
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
nllerr("read: %d\n", errno);
|
||||
nllerr("ERROR: read: %d\n", errno);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -651,7 +651,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc)
|
||||
{
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
nllerr("read: %d\n", errno);
|
||||
nllerr("ERROR: read: %d\n", errno);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -1034,13 +1034,14 @@ int cgi(httpd_conn *hc)
|
||||
(main_t)cgi_child, (FAR char * const *)argv);
|
||||
if (child < 0)
|
||||
{
|
||||
nerr("task_create: %d\n", errno);
|
||||
nerr("ERROR: task_create: %d\n", errno);
|
||||
INTERNALERROR("task_create");
|
||||
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
|
||||
httpd_send_err(hc, 500, err500title, "", err500form,
|
||||
hc->encodedurl);
|
||||
goto errout_with_sem;
|
||||
}
|
||||
|
||||
nerr("Started CGI task %d for file '%s'\n", child, hc->expnfilename);
|
||||
ninfo("Started CGI task %d for file '%s'\n", child, hc->expnfilename);
|
||||
|
||||
/* Wait for the CGI threads to become initialized */
|
||||
|
||||
@ -1052,7 +1053,8 @@ int cgi(httpd_conn *hc)
|
||||
else
|
||||
{
|
||||
NOTIMPLEMENTED("CGI");
|
||||
httpd_send_err(hc, 501, err501title, "", err501form, httpd_method_str(hc->method));
|
||||
httpd_send_err(hc, 501, err501title, "", err501form,
|
||||
httpd_method_str(hc->method));
|
||||
goto errout_with_sem;
|
||||
}
|
||||
|
||||
@ -1072,10 +1074,10 @@ static void cgi_kill(ClientData client_data, struct timeval *nowP)
|
||||
|
||||
/* task_delete() is a very evil API. It can leave memory stranded! */
|
||||
|
||||
nllerr("Killing CGI child: %d\n", pid);
|
||||
nllinfo("Killing CGI child: %d\n", pid);
|
||||
if (task_delete(pid) != 0)
|
||||
{
|
||||
nllerr("task_delete() failed: %d\n", errno);
|
||||
nllerr("ERROR: task_delete() failed: %d\n", errno);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -396,12 +396,13 @@ static int wget_gethostip(FAR char *hostname, in_addr_t *ipv4addr)
|
||||
he = gethostbyname(hostname);
|
||||
if (he == NULL)
|
||||
{
|
||||
nerr("gethostbyname failed: %d\n", h_errno);
|
||||
nwarn("WARNING: gethostbyname failed: %d\n", h_errno);
|
||||
return -ENOENT;
|
||||
}
|
||||
else if (he->h_addrtype != AF_INET)
|
||||
{
|
||||
nerr("gethostbyname returned an address of type: %d\n", he->h_addrtype);
|
||||
nwarn("WARNING: gethostbyname returned an address of type: %d\n",
|
||||
he->h_addrtype);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@ -465,7 +466,7 @@ static int wget_base(FAR const char *url, FAR char *buffer, int buflen,
|
||||
ws.filename, CONFIG_WEBCLIENT_MAXFILENAME);
|
||||
if (ret != 0)
|
||||
{
|
||||
nerr("ERROR: Malformed HTTP URL: %s\n", url);
|
||||
nwarn("WARNING: Malformed HTTP URL: %s\n", url);
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
@ -516,7 +517,7 @@ static int wget_base(FAR const char *url, FAR char *buffer, int buflen,
|
||||
{
|
||||
/* Could not resolve host (or malformed IP address) */
|
||||
|
||||
nerr("ERROR: Failed to resolve hostname\n");
|
||||
nwarn("WARNING: Failed to resolve hostname\n");
|
||||
ret = -EHOSTUNREACH;
|
||||
goto errout_with_errno;
|
||||
}
|
||||
|
@ -516,7 +516,8 @@ static int httpd_sendfile(struct httpd_state *pstate)
|
||||
|
||||
if (httpd_openindex(pstate) != OK)
|
||||
{
|
||||
nerr("[%d] '%s' not found\n", pstate->ht_sockfd, pstate->ht_filename);
|
||||
nwarn("WARNING: [%d] '%s' not found\n",
|
||||
pstate->ht_sockfd, pstate->ht_filename);
|
||||
return httpd_senderror(pstate, 404);
|
||||
}
|
||||
|
||||
@ -577,7 +578,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (o == pstate->ht_buffer + sizeof pstate->ht_buffer)
|
||||
{
|
||||
nerr("[%d] ht_buffer overflow\n");
|
||||
nerr("ERROR: [%d] ht_buffer overflow\n");
|
||||
return 413;
|
||||
}
|
||||
|
||||
@ -588,20 +589,21 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
sizeof pstate->ht_buffer - (o - pstate->ht_buffer), 0);
|
||||
if (r == 0)
|
||||
{
|
||||
nerr("[%d] connection lost\n", pstate->ht_sockfd);
|
||||
nwarn("WARNING: [%d] connection lost\n", pstate->ht_sockfd);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#if CONFIG_NETUTILS_HTTPD_TIMEOUT > 0
|
||||
if (r == -1 && errno == EWOULDBLOCK)
|
||||
{
|
||||
nerr("[%d] recv timeout\n");
|
||||
nwarn("WARNING: [%d] recv timeout\n");
|
||||
return 408;
|
||||
}
|
||||
#endif
|
||||
if (r == -1)
|
||||
{
|
||||
nerr("[%d] recv failed: %d\n", pstate->ht_sockfd, errno);
|
||||
nerr("ERROR: [%d] recv failed: %d\n",
|
||||
pstate->ht_sockfd, errno);
|
||||
return 400;
|
||||
}
|
||||
|
||||
@ -625,7 +627,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (*end != '\n')
|
||||
{
|
||||
nerr("[%d] expected CRLF\n");
|
||||
nwarn("WARNING: [%d] expected CRLF\n");
|
||||
return 400;
|
||||
}
|
||||
|
||||
@ -638,7 +640,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
case STATE_METHOD:
|
||||
if (0 != strncmp(start, "GET ", 4))
|
||||
{
|
||||
nerr("[%d] method not supported\n");
|
||||
nwarn("WARNING: [%d] method not supported\n");
|
||||
return 501;
|
||||
}
|
||||
|
||||
@ -647,7 +649,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (0 != strcmp(v, " HTTP/1.0") && 0 != strcmp(v, " HTTP/1.1"))
|
||||
{
|
||||
nerr("[%d] HTTP version not supported\n");
|
||||
nwarn("WARNING: [%d] HTTP version not supported\n");
|
||||
return 505;
|
||||
}
|
||||
|
||||
@ -655,7 +657,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (v - start >= sizeof pstate->ht_filename)
|
||||
{
|
||||
nerr("[%d] ht_filename overflow\n");
|
||||
nerr("ERROR: [%d] ht_filename overflow\n");
|
||||
return 414;
|
||||
}
|
||||
|
||||
@ -680,7 +682,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (*start == '\0' || *v == '\0')
|
||||
{
|
||||
nerr("[%d] header parse error\n");
|
||||
nwarn("WARNING: [%d] header parse error\n");
|
||||
return 400;
|
||||
}
|
||||
|
||||
@ -688,7 +690,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
|
||||
|
||||
if (0 == strcasecmp(start, "Content-Length") && 0 != atoi(v))
|
||||
{
|
||||
nerr("[%d] non-zero request length\n");
|
||||
nwarn("WARNING: [%d] non-zero request length\n");
|
||||
return 413;
|
||||
}
|
||||
#ifndef CONFIG_NETUTILS_HTTPD_KEEPALIVE_DISABLE
|
||||
@ -815,7 +817,7 @@ static void single_server(uint16_t portno, pthread_startroutine_t handler, int s
|
||||
|
||||
if (acceptsd < 0)
|
||||
{
|
||||
nerr("accept failure: %d\n", errno);
|
||||
nerr("ERROR: accept failure: %d\n", errno);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -829,7 +831,7 @@ static void single_server(uint16_t portno, pthread_startroutine_t handler, int s
|
||||
if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0)
|
||||
{
|
||||
close(acceptsd);
|
||||
nerr("setsockopt SO_LINGER failure: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_LINGER failure: %d\n", errno);
|
||||
break;;
|
||||
}
|
||||
#endif
|
||||
@ -842,7 +844,7 @@ static void single_server(uint16_t portno, pthread_startroutine_t handler, int s
|
||||
if (setsockopt(acceptsd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval)) < 0)
|
||||
{
|
||||
close(acceptsd);
|
||||
nerr("setsockopt SO_RCVTIMEO failure: %d\n", errno);
|
||||
nerr("ERROR: setsockopt SO_RCVTIMEO failure: %d\n", errno);
|
||||
break;;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user