]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: teach symlink_remove return error on removal failure
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Apr 2011 11:06:40 +0000 (14:06 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 22 Apr 2011 11:29:52 +0000 (14:29 +0300)
When 'symlink_remove()' fails to unling a symlink - return an error to
the calling function.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index f56ff66b1e944fb9d2407c22e22fe2edfa4a5fc3..a4862295d38298c050bd178aeaf7ef56697dcc03 100644 (file)
@@ -482,7 +482,7 @@ static int dir_new(struct dir_info *parent, const char *name)
 
 static int file_delete(struct file_info *file);
 static int file_unlink(struct dir_entry_info *entry);
-static void symlink_remove(struct symlink_info *symlink);
+static int symlink_remove(struct symlink_info *symlink);
 
 static void dir_remove(struct dir_info *dir)
 {
@@ -1851,16 +1851,20 @@ static int symlink_new(struct dir_info *dir, const char *nm)
        return 0;
 }
 
-static void symlink_remove(struct symlink_info *symlink)
+static int symlink_remove(struct symlink_info *symlink)
 {
        char *path;
 
        path = dir_path(symlink->entry->parent, symlink->entry->name);
+       if (unlink(path) != 0) {
+               pcv("cannot unlink symlink %s", path);
+               free(path);
+               return -1;
+       }
 
        remove_dir_entry(symlink->entry);
-
-       CHECK(unlink(path) == 0);
        free(path);
+       return 0;
 }
 
 static int operate_on_dir(struct dir_info *dir);
@@ -1915,7 +1919,7 @@ static int operate_on_entry(struct dir_entry_info *entry)
                symlink_check(entry->symlink);
                /* If shrinking, 1 time in 50, remove a symlink */
                if (shrink && random_no(50) == 0)
-                       symlink_remove(entry->symlink);
+                       return symlink_remove(entry->symlink);
                return 0;
        }
        if (entry->type == 'd') {