]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: close files after creation
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Thu, 26 May 2011 10:43:13 +0000 (13:43 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 27 May 2011 12:55:08 +0000 (15:55 +0300)
The 'file_new()' function should create a file but should not keep it
open. There is a different path to open files and keep them open. This
patch makes 'file_new()' close newly created files.

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

index 748b6cb330a60f671229a6f9e630af05bcd095cc..8b1fb406677becfd486f06156c1dccbd31973b79 100644 (file)
@@ -633,7 +633,6 @@ static int dir_remove(struct dir_info *dir)
 
 static int file_new(struct dir_info *parent, const char *name)
 {
-       struct file_info *file;
        char *path;
        mode_t mode;
        int fd;
@@ -661,9 +660,10 @@ static int file_new(struct dir_info *parent, const char *name)
                CHECK(lstat(path, &st) == 0);
                CHECK(S_ISREG(st.st_mode));
        }
-       file = add_dir_entry(parent, 'f', name, NULL);
-       add_fd(file, fd);
 
+       add_dir_entry(parent, 'f', name, NULL);
+
+       close(fd);
        free(path);
        return 0;
 }