You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/06/08 18:20:01 UTC

[incubator-nuttx-apps] 01/02: fsutils/ipcfg: Add assert header

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 3f2db83898057f727170191c53539b96ba6ac308
Author: David Sidrane <Da...@NscDg.com>
AuthorDate: Tue Jun 8 09:12:40 2021 -0700

    fsutils/ipcfg: Add assert header
---
 fsutils/ipcfg/ipcfg.c        | 1 +
 fsutils/ipcfg/ipcfg_binary.c | 4 +++-
 fsutils/ipcfg/ipcfg_text.c   | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fsutils/ipcfg/ipcfg.c b/fsutils/ipcfg/ipcfg.c
index d1f00b3..ae73608 100644
--- a/fsutils/ipcfg/ipcfg.c
+++ b/fsutils/ipcfg/ipcfg.c
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include <debug.h>
 
 #include "fsutils/ipcfg.h"
diff --git a/fsutils/ipcfg/ipcfg_binary.c b/fsutils/ipcfg/ipcfg_binary.c
index 8d4dc2b..85baae3 100644
--- a/fsutils/ipcfg/ipcfg_binary.c
+++ b/fsutils/ipcfg/ipcfg_binary.c
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <assert.h>
 #include <debug.h>
 
 #include "fsutils/ipcfg.h"
@@ -384,7 +385,7 @@ int ipcfg_write_binary_ipv4(FAR const char *path,
   int fd;
   int ret;
 
-  DEBUGASSERT(fd >= 0 && ipv4cfg != NULL);
+  DEBUGASSERT(ipv4cfg != NULL);
 
 #ifdef CONFIG_NET_IPv6
   /* Read any IPv6 data in the file */
@@ -410,6 +411,7 @@ int ipcfg_write_binary_ipv4(FAR const char *path,
   /* Open the file for writing (truncates) */
 
   fd = ipcfg_open(path, O_WRONLY | O_TRUNC | O_CREAT, 0666);
+  DEBUGASSERT(fd >= 0);
   if (fd < 0)
     {
       return fd;
diff --git a/fsutils/ipcfg/ipcfg_text.c b/fsutils/ipcfg/ipcfg_text.c
index ef89047..ab9f9d0 100644
--- a/fsutils/ipcfg/ipcfg_text.c
+++ b/fsutils/ipcfg/ipcfg_text.c
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <ctype.h>
+#include <assert.h>
 #include <debug.h>
 
 #include <arpa/inet.h>