summaryrefslogtreecommitdiff
path: root/tests/fs-tests/integrity
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2008-08-12 14:08:06 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 18:43:29 +0300
commit57d30a2e46e3d4f8c8440e0f9a89db36a630f98d (patch)
treecf849d0b500832ea530da1bda9d3ee101e7cf453 /tests/fs-tests/integrity
parent0b2b9c506739c15ec4d31b0a1f74ed583a5e6134 (diff)
fs-tests: fix symlink bug in integrity test
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/fs-tests/integrity')
-rw-r--r--tests/fs-tests/integrity/integck.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index f1a544a..be93d3e 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1655,22 +1655,31 @@ static char *pick_symlink_target(const char *symlink_path)
return rel_path;
}
-static void symlink_new(struct dir_info *dir, const char *name)
+static void symlink_new(struct dir_info *dir, const char *name_)
{
struct symlink_info *s;
- char *path;
+ char *path, *target, *name = copy_string(name_);
size_t sz;
+ path = dir_path(dir, name);
+ target = pick_symlink_target(path);
+ if (symlink(target, path) == -1) {
+ CHECK(errno == ENOSPC);
+ full = 1;
+ free(target);
+ free(path);
+ free(name);
+ return;
+ }
+ free(path);
+
sz = sizeof(struct symlink_info);
s = malloc(sz);
CHECK(s != NULL);
memset(s, 0, sz);
add_dir_entry(dir, 's', name, s);
-
- path = dir_path(dir, name);
- s->target_pathname = pick_symlink_target(path);
- CHECK(symlink(s->target_pathname, path) != -1);
- free(path);
+ s->target_pathname = target;
+ free(name);
}
static void symlink_remove(struct symlink_info *symlink)