Commit b14014ed authored by Petteri Mäki's avatar Petteri Mäki
Browse files

errno stuff

parent 635b2b0e
......@@ -86,7 +86,7 @@ int dns_gethostip_multi(FAR const char *hostname, FAR in_addr_t *ipaddr,
if (nipaddr == 0 || !ipaddr)
{
errno = EINVAL;
set_errno(EINVAL);
return ret;
}
......@@ -96,7 +96,7 @@ int dns_gethostip_multi(FAR const char *hostname, FAR in_addr_t *ipaddr,
ret = dns_query_sock_multi(sockfd, hostname, ipaddr, nipaddr);
err = errno;
dns_free_sock(&sockfd);
errno = err;
set_errno(err);
}
return ret;
......
/****************************************************************************
* apps/netutils/dnsclient/dns_socket.c
* DNS host name to IP address resolver.
......@@ -404,7 +405,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
{
/* Too long name! */
errno = EMSGSIZE;
set_errno(EMSGSIZE);
return ERROR;
}
......@@ -416,7 +417,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
{
/* Too long name! */
errno = EMSGSIZE;
set_errno(EMSGSIZE);
return ERROR;
}
......@@ -432,7 +433,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
{
/* Too long name! */
errno = EMSGSIZE;
set_errno(EMSGSIZE);
return ERROR;
}
......@@ -448,7 +449,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
{
/* Too long name! */
errno = EMSGSIZE;
set_errno(EMSGSIZE);
return ERROR;
}
......@@ -463,7 +464,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
{
/* Out of memory. */
errno = ENOMEM;
set_errno(ENOMEM);
return ERROR;
}
......@@ -485,7 +486,7 @@ static int dns_send_query(int sockfd, FAR const char *name,
int err = errno;
free(qinfo->qname);
qinfo->qname = NULL;
errno = err;
set_errno(err);
}
return wlen;
......@@ -534,7 +535,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
/* Not response from DNS server. */
ndbg("packet from wrong address\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -543,7 +544,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
/* Not response from DNS server. */
ndbg("packet from wrong port\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -554,7 +555,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
ndbg("too short DNS response (len: %d, expect at least: %d)\n",
buflen, sizeof(*hdr));
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -571,7 +572,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
if ((hdr->flags2 & DNS_FLAG2_ERR_MASK) != 0)
{
errno = EHOSTUNREACH;
set_errno(EHOSTUNREACH);
return ERROR;
}
......@@ -582,7 +583,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
ndbg("wrong DNS response ID (expected %d, got %d).\n",
qinfo->id, hdr->id);
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -597,7 +598,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
{
ndbg("wrong number of questions (expected %d, got %d).\n", 1, nquestions);
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -642,7 +643,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
{
ndbg("invalid DNS response, response name different length than query.\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -650,7 +651,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
{
ndbg("invalid DNS response, response name mismatch query.\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -659,7 +660,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
{
ndbg("malformed DNS response, no answers section.\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -670,7 +671,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
{
ndbg("invalid DNS response, question section mismatch.\n");
errno = EBADMSG;
set_errno(EBADMSG);
return ERROR;
}
......@@ -779,7 +780,7 @@ static int dns_recv_response(int sockfd, FAR in_addr_t *inaddr, size_t naddr,
return naddr_read;
}
errno = errval;
set_errno(errval);
return ERROR;
}
......@@ -815,7 +816,7 @@ int dns_bind_sock(FAR int *sockfd)
{
err = errno;
ndbg("ERROR: socket() failed: %d\n", errno);
errno = err;
set_errno(err);
return ERROR;
}
......@@ -833,7 +834,7 @@ int dns_bind_sock(FAR int *sockfd)
ndbg("ERROR: setsockopt() failed: %d\n", errno);
close(*sockfd);
*sockfd = -1;
errno = err;
set_errno(err);
return ERROR;
}
......@@ -920,7 +921,7 @@ int dns_query_sock_multi(int sockfd, FAR const char *hostname,
if (!ipaddr || nipaddr == 0)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
......@@ -1208,7 +1209,7 @@ int dns_whois_socket_multi(int sockfd, FAR const char *name,
if (naddr == 0 || !addr)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
......@@ -1285,6 +1286,6 @@ int dns_whois_socket_multi(int sockfd, FAR const char *name,
err_out:
free(buffer);
dns_increase_lookup_failed_count();
errno = err;
set_errno(err);
return ERROR;
}
......@@ -964,7 +964,7 @@ int __conman_ubmodem_send_sms(struct conman_s *conman,
if (!item)
{
free(sms);
errno = -ENOMEM;
set_errno(-ENOMEM);
return ERROR;
}
......
......@@ -256,7 +256,7 @@ int ubmodem_start_cell_locate(struct ubmodem_s *modem)
if (modem->level < UBMODEM_LEVEL_GPRS)
{
errno = ENONET;
set_errno(ENONET);
return ERROR;
}
......
......@@ -133,7 +133,7 @@ int ubmodem_send_raw_command(struct ubmodem_s *modem,
cmdtask = calloc(1, sizeof(*cmdtask) + buflen);
if (!cmdtask)
{
errno = ENOMEM;
set_errno(ENOMEM);
return ERROR;
}
......
......@@ -515,6 +515,6 @@ int ubmodem_get_info(struct ubmodem_s *modem, ubmodem_info_cb_t result_cb,
err_out:
errno = err;
set_errno(err);
return ERROR;
}
......@@ -187,7 +187,7 @@ static int modem_poll_event(struct ubmodem_s *modem, struct pollfd *pfd,
if (pfd == NULL && numpfds > 0)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
......@@ -426,7 +426,7 @@ int ubmodem_pollfds_setup(struct ubmodem_s *modem, struct pollfd *pfd,
if (pfd == NULL || timeout == NULL)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
......
......@@ -549,6 +549,6 @@ int ubmodem_send_sms(struct ubmodem_s *modem, const char *receiver,
err_out:
free(msg_pdu);
free(recv_pdu);
errno = err;
set_errno(err);
return ERROR;
}
......@@ -76,8 +76,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif
ARCHOPTIMIZATION += -fdata-sections -ffunction-sections
LDFLAGS += --gc-sections
# --sort-section=shuffle_obfuscation
LDFLAGS += --gc-sections --sort-section=shuffle_obfuscation
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
......@@ -89,8 +88,10 @@ endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
ARCHWARNINGS = -Wall -Werror -Wno-error=cpp -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Werror -Wno-error=cpp -Wshadow
#ARCHWARNINGS = -Wall -Werror -Wno-error=cpp -Wstrict-prototypes -Wshadow
#ARCHWARNINGSXX = -Wall -Werror -Wno-error=cpp -Wshadow
ARCHWARNINGS = -Wall -Wno-error=cpp -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wno-error=cpp -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment