summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-18 13:41:38 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-22 14:29:52 +0300
commit717ce147ee1c0ae7a5ffc45b322c2da6bbf37019 (patch)
tree4f624d2a8f651ef0f8ce5feaf788930df1ee6284
parent367cebd53a3da54813a00dd62cbcd23b5db12fd1 (diff)
fs-tests: integck: teach link_new to return error on creation failure
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--tests/fs-tests/integrity/integck.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index fbf24fb..14d112f 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -542,8 +542,8 @@ static int file_new(struct dir_info *parent, const char *name)
return 0;
}
-static void link_new(struct dir_info *parent, const char *name,
- struct file_info *file)
+static int link_new(struct dir_info *parent, const char *name,
+ struct file_info *file)
{
struct dir_entry_info *entry;
char *path, *target;
@@ -551,21 +551,26 @@ static void link_new(struct dir_info *parent, const char *name,
entry = file->links;
if (!entry)
- return;
+ return 0;
+
path = dir_path(parent, name);
target = dir_path(entry->parent, entry->name);
ret = link(target, path);
if (ret != 0) {
- CHECK(errno == ENOSPC);
+ if (errno == ENOSPC) {
+ ret = 0;
+ full = 1;
+ } else
+ pcv("cannot create hardlink %s in directory %s to file %s",
+ path, parent->name, target);
free(target);
free(path);
- full = 1;
- return;
+ return ret;
}
free(target);
free(path);
-
add_dir_entry(parent, 'f', name, file);
+ return 0;
}
static void file_close(struct fd_info *fdi);
@@ -1952,7 +1957,7 @@ static int operate_on_dir(struct dir_info *dir)
return dir_new(dir, make_name(dir));
else if (r == 2 && grow && (file = pick_file()) != NULL)
/* When growing, 1 time in 14 create a hard link */
- link_new(dir, make_name(dir), file);
+ return link_new(dir, make_name(dir), file);
else if (r == 3 && grow && random_no(5) == 0)
/* When growing, 1 time in 70 create a symbolic link */
return symlink_new(dir, make_name(dir));