Răsfoiți Sursa

修正HAL_TCP_Destroy()中, 规避close(0)将console的rx_indicate清除

warfalcon-spunky 6 ani în urmă
părinte
comite
5195686b9d
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      ports/rtthread/HAL_TCP_rtthread.c

+ 8 - 0
ports/rtthread/HAL_TCP_rtthread.c

@@ -113,6 +113,14 @@ uintptr_t HAL_TCP_Establish(const char *host, uint16_t port)
 int32_t HAL_TCP_Destroy(uintptr_t fd)
 int32_t HAL_TCP_Destroy(uintptr_t fd)
 {
 {
     int rc;
     int rc;
+	
+#if defined(RT_USING_DFS_DEVFS) && defined(RT_USING_POSIX)
+    if ((0 <= (int)fd) && ((int)fd <= 2))
+    {
+        LOG_I("the FD of user can not less than 2 in rt-thread OS, Please see fd_get() in dfs.c.");
+        return 0;
+    }
+#endif
 
 
     rc = close((int) fd);
     rc = close((int) fd);
     if (0 != rc) {
     if (0 != rc) {