/* Nagative case with invalid argument, invalid fd. It will return ERROR */
#if CONFIG_NFILE_DESCRIPTORS > 0
- ret = dup(CONFIG_NFILE_DESCRIPTORS);
- TC_ASSERT_EQ("dup", ret, ERROR);
+ fd1 = dup(CONFIG_NFILE_DESCRIPTORS);
+ TC_ASSERT_LT_CLEANUP("dup", fd1, 0, close(fd1));
#endif
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
- ret = dup(CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS);
- TC_ASSERT_EQ("dup", ret, ERROR);
+ fd1 = dup(CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS);
+ TC_ASSERT_LT_CLEANUP("dup", fd1, 0, close(fd1));
#endif
TC_SUCCESS_RESULT();
/* Nagative case with invalid argument, invalid fd. It will return ERROR */
fd1 = -1;
ret = dup2(CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS, fd1);
- TC_ASSERT_LT_CLEANUP("dup2", fd1, 0, close(fd1));
+ close(fd1);
+ TC_ASSERT_LT("dup2", fd1, 0);
TC_ASSERT_EQ("dup2", ret, ERROR);
TC_SUCCESS_RESULT();
/* Nagative case with invalid argument, fd. It will return ERROR */
ret = fsync(CONFIG_NFILE_DESCRIPTORS);
- TC_ASSERT_EQ_CLEANUP("fsync", ret, ERROR, close(fd));
+ TC_ASSERT_EQ("fsync", ret, ERROR);
TC_SUCCESS_RESULT();
}
dirp = opendir(VFS_FOLDER_PATH);
TC_ASSERT("opendir", dirp);
+ closedir(dirp);
TC_SUCCESS_RESULT();
}
TC_ASSERT_EQ("closedir", ret, OK);
dirp = opendir("nodir");
- TC_ASSERT_EQ("opendir", dirp, NULL);
+ TC_ASSERT_EQ_CLEANUP("opendir", dirp, NULL, closedir(dirp));
ret = closedir(NULL);
TC_ASSERT_EQ("closedir", ret, ERROR);
};
#endif
+#ifdef CONFIG_MTD_PARTITION_NAMES
+#define MTD_PARTNAME_LEN 11
+#endif
+
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
ssize_t blkpererase;
ssize_t ret;
#ifdef CONFIG_MTD_PARTITION_NAMES
- char partname[11];
+ char partname[MTD_PARTNAME_LEN];
FAR const char *ptr;
uint8_t x;
#endif
#ifdef CONFIG_MTD_PARTITION_NAMES
if (attr->nextpart->name == NULL) {
- strcpy(partname, "(noname) ");
+ strncpy(partname, "(noname) ", MTD_PARTNAME_LEN);
} else {
ptr = attr->nextpart->name;
for (x = 0; x < sizeof(partname) - 1; x++) {