txlyre 2 달 전
부모
커밋
24b09c4ebc
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      qic.c

+ 8 - 1
qic.c

@@ -5000,6 +5000,14 @@ int require_once(buffer_t *gbuf, buffer_t *buf, list_t *ctx, table_t *ltab,
         return -1;
     }
 
+    path = realpath(path, NULL);
+
+    if (is_required(path)) {
+      fclose(fd);
+
+      return 1;
+    }
+    
     buffer_t *fbuf = buffer_new();
 
     for (;;)
@@ -5013,7 +5021,6 @@ int require_once(buffer_t *gbuf, buffer_t *buf, list_t *ctx, table_t *ltab,
     }
 
     source = buffer_read(fbuf);
-    path = realpath(path, NULL);
   }
 
   list_t *pair = list_new();