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>
static int file_new(struct dir_info *parent, const char *name)
{
- struct file_info *file;
char *path;
mode_t mode;
int fd;
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;
}