未验证 提交 f5a6b72c 编写于 作者: O openharmony_ci 提交者: Gitee

!673 fix closedir test

Merge pull request !673 from olefirenkoegor/fix-test
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
*/ */
#include <dirent.h> #include <dirent.h>
#include <string.h>
#include <malloc.h>
#include "functionalext.h" #include "functionalext.h"
#define MAXPATH 1000 #define MAXPATH 1000
#define BUFFSIZE 4096
/** /**
* @tc.name : closedir_0100 * @tc.name : closedir_0100
...@@ -42,9 +45,13 @@ void closedir_0100(void) ...@@ -42,9 +45,13 @@ void closedir_0100(void)
*/ */
void closedir_0200(void) void closedir_0200(void)
{ {
DIR *dir = (DIR *)"/notexist";
int ret = 0; int ret = 0;
ret = closedir(dir); DIR *dir = (DIR *)malloc(BUFFSIZE);
if (dir != NULL) {
// fill to set dir->fd = -1 (intentionally incorrect file descriptor)
memset(dir, 0xFF, BUFFSIZE);
ret = closedir(dir);
}
EXPECT_EQ("closedir_0200", ret, -1); EXPECT_EQ("closedir_0200", ret, -1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册