Unit test for tree functions. Little fixes.

This commit is contained in:
Vreixo Formoso
2007-12-06 22:45:16 +01:00
parent 5df6b2c3d2
commit 7f9c5c9065
5 changed files with 267 additions and 4 deletions

View File

@ -130,6 +130,9 @@ int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
if (parent == NULL || name == NULL || dest == NULL) {
return ISO_NULL_POINTER;
}
if (link) {
*link = NULL;
}
/* find place where to insert */
pos = &(parent->children);
@ -232,9 +235,12 @@ int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
if (parent == NULL || name == NULL) {
return ISO_NULL_POINTER;
}
if (mode & (S_IFLNK | S_IFREG | S_IFDIR)) {
if (S_ISLNK(mode) || S_ISREG(mode) || S_ISDIR(mode)) {
return ISO_WRONG_ARG_VALUE;
}
if (special) {
*special = NULL;
}
/* find place where to insert */
pos = &(parent->children);