Include assert.h for DEBUGASSERT caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-05-20 11:32:57 +08:00 committed by Masayuki Ishikawa
parent d3f8f423d5
commit 1ee948e0c8
16 changed files with 50 additions and 29 deletions

View File

@ -32,6 +32,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <poll.h> #include <poll.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
/**************************************************************************** /****************************************************************************

View File

@ -42,6 +42,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include "passwd.h" #include "passwd.h"
@ -110,7 +111,7 @@ int passwd_find(FAR const char *username, FAR struct passwd_s *passwd)
offset = 0; offset = 0;
ret = -ENOENT; ret = -ENOENT;
while (fgets(iobuffer, CONFIG_FSUTILS_PASSWD_IOBUFFER_SIZE, stream) != NULL) while (fgets(iobuffer, CONFIG_FSUTILS_PASSWD_IOBUFFER_SIZE, stream))
{ {
ptr = iobuffer; ptr = iobuffer;
name = ptr; name = ptr;

View File

@ -1629,7 +1629,6 @@ int dhcpd_start(FAR const char *interface)
if (pid < 0) if (pid < 0)
{ {
int errval = errno; int errval = errno;
DEBUGASSERT(errval > 0);
g_dhcpd_daemon.ds_state = DHCPD_STOPPED; g_dhcpd_daemon.ds_state = DHCPD_STOPPED;
nerr("ERROR: Failed to start the DHCPD daemon: %d\n", errval); nerr("ERROR: Failed to start the DHCPD daemon: %d\n", errval);

View File

@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>

View File

@ -44,6 +44,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <libgen.h> #include <libgen.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>

View File

@ -44,6 +44,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <libgen.h> #include <libgen.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>

View File

@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
@ -148,8 +149,9 @@ errout:
void ftpc_sockclose(FAR struct ftpc_socket_s *sock) void ftpc_sockclose(FAR struct ftpc_socket_s *sock)
{ {
/* Note that the same underlying socket descriptor is used for both streams. /* Note that the same underlying socket descriptor is used for both
* There should be harmless failures on the second fclose and the close. * streams. There should be harmless failures on the second fclose
* and the close.
*/ */
fclose(sock->instream); fclose(sock->instream);
@ -168,7 +170,8 @@ void ftpc_sockclose(FAR struct ftpc_socket_s *sock)
* *
****************************************************************************/ ****************************************************************************/
int ftpc_sockconnect(FAR struct ftpc_socket_s *sock, FAR struct sockaddr *addr) int ftpc_sockconnect(FAR struct ftpc_socket_s *sock,
FAR struct sockaddr *addr)
{ {
int ret; int ret;
@ -177,14 +180,16 @@ int ftpc_sockconnect(FAR struct ftpc_socket_s *sock, FAR struct sockaddr *addr)
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
if (addr->sa_family == AF_INET6) if (addr->sa_family == AF_INET6)
{ {
ret = connect(sock->sd, (struct sockaddr *)addr, sizeof(struct sockaddr_in6)); ret = connect(sock->sd, (struct sockaddr *)addr,
sizeof(struct sockaddr_in6));
} }
else else
#endif #endif
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
if (addr->sa_family == AF_INET) if (addr->sa_family == AF_INET)
{ {
ret = connect(sock->sd, (struct sockaddr *)addr, sizeof(struct sockaddr_in)); ret = connect(sock->sd, (struct sockaddr *)addr,
sizeof(struct sockaddr_in));
} }
else else
#endif #endif
@ -234,21 +239,21 @@ void ftpc_sockcopy(FAR struct ftpc_socket_s *dest,
* Accept a connection on the data socket. This function is only used * Accept a connection on the data socket. This function is only used
* in active mode. * in active mode.
* *
* In active mode FTP the client connects from a random port (N>1023) to the * In active mode FTP the client connects from a random port (N>1023) to
* FTP server's command port, port 21. Then, the client starts listening to * the FTP server's command port, port 21. Then, the client starts
* port N+1 and sends the FTP command PORT N+1 to the FTP server. The server * listening to port N+1 and sends the FTP command PORT N+1 to the FTP
* will then connect back to the client's specified data port from its local * server. The server will then connect back to the client's specified data
* data port, which is port 20. In passive mode FTP the client initiates * port from its local data port, which is port 20. In passive mode FTP the
* both connections to the server, solving the problem of firewalls filtering * client initiates both connections to the server, solving the problem of
* the incoming data port connection to the client from the server. When * firewalls filtering the incoming data port connection to the client from
* opening an FTP connection, the client opens two random ports locally * the server. When opening an FTP connection, the client opens two random
* (N>1023 and N+1). The first port contacts the server on port 21, but * ports locally (N>1023 and N+1). The first port contacts the server on
* instead of then issuing a PORT command and allowing the server to connect * port 21, but instead of then issuing a PORT command and allowing the
* back to its data port, the client will issue the PASV command. The result * server to connect back to its data port, the client will issue the PASV
* of this is that the server then opens a random unprivileged port (P > * command. The result of this is that the server then opens a random
* 1023) and sends the PORT P command back to the client. The client then * unprivileged port (P > 1023) and sends the PORT P command back to the
* initiates the connection from port N+1 to port P on the server to transfer * client. The client then initiates the connection from port N+1 to port P
* data. * on the server to transfer data.
* *
****************************************************************************/ ****************************************************************************/
@ -318,7 +323,7 @@ errout_with_sd:
* Name: ftpc_socklisten * Name: ftpc_socklisten
* *
* Description: * Description:
* Bind the socket to local address and wait for connection from the server. * Bind the socket to local address and wait for connection from server.
* *
****************************************************************************/ ****************************************************************************/
@ -411,5 +416,6 @@ int ftpc_sockgetsockname(FAR struct ftpc_socket_s *sock,
nerr("ERROR: getsockname failed: %d\n", errno); nerr("ERROR: getsockname failed: %d\n", errno);
return ERROR; return ERROR;
} }
return OK; return OK;
} }

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* netutils/netlib/netlib_ipv4adaptor.c * apps/netutils/netlib/netlib_ipv4adaptor.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <net/if.h> #include <net/if.h>
@ -87,7 +88,8 @@
* *
****************************************************************************/ ****************************************************************************/
static int _netlib_ipv4adaptor(in_addr_t destipaddr, FAR in_addr_t *srcipaddr) static int _netlib_ipv4adaptor(in_addr_t destipaddr,
FAR in_addr_t *srcipaddr)
{ {
FAR struct ifreq *ifr; FAR struct ifreq *ifr;
struct ifconf ifc; struct ifconf ifc;

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* netutils/netlib/netlib_ipv6adaptor.c * apps/netutils/netlib/netlib_ipv6adaptor.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <net/if.h> #include <net/if.h>
@ -179,7 +180,8 @@ static int _netlib_ipv6adaptor(FAR const struct in6_addr *destipaddr,
strncpy(maskreq.lifr_name, lifr->lifr_name, IFNAMSIZ); strncpy(maskreq.lifr_name, lifr->lifr_name, IFNAMSIZ);
status = ioctl(sd, SIOCGLIFNETMASK, (unsigned long)((uintptr_t)&maskreq)); status = ioctl(sd, SIOCGLIFNETMASK,
(unsigned long)((uintptr_t)&maskreq));
if (status < 0) if (status < 0)
{ {
ret = -errno; ret = -errno;

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* netutils/ntpclient/ntpclient.c * apps/netutils/ntpclient/ntpclient.c
* *
* Copyright (C) 2014, 2016, 2020 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016, 2020 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -50,6 +50,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <sched.h> #include <sched.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>

View File

@ -53,6 +53,7 @@
#include <signal.h> #include <signal.h>
#include <semaphore.h> #include <semaphore.h>
#include <sched.h> #include <sched.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>

View File

@ -47,6 +47,7 @@
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h> #include <dirent.h>
#include <assert.h>
#include "nsh.h" #include "nsh.h"
#include "nsh_console.h" #include "nsh_console.h"

View File

@ -56,6 +56,7 @@
#include <fcntl.h> /* Needed for open */ #include <fcntl.h> /* Needed for open */
#include <dirent.h> #include <dirent.h>
#include <libgen.h> /* Needed for basename */ #include <libgen.h> /* Needed for basename */
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>

View File

@ -43,6 +43,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h>
#ifdef CONFIG_NSH_CLE #ifdef CONFIG_NSH_CLE
# include "system/cle.h" # include "system/cle.h"

View File

@ -31,6 +31,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <sched.h> #include <sched.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/testing/getprime_main.c * apps/testing/getprime/getprime_main.c
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -30,6 +30,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <pthread.h> #include <pthread.h>
#include <time.h> #include <time.h>
#include <assert.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions