From 2beb17a6417cab1d4ebc9cb885938536be4e9cc7 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Mon, 5 Jun 2023 06:39:26 +0900 Subject: [PATCH] lsfd: assign a class to the file in new_file() Signed-off-by: Masatake YAMATO --- misc-utils/lsfd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index 05a5f3f4db..bf7b214f18 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -612,7 +612,10 @@ static struct file *new_file(struct proc *proc, const struct file_class *class) { struct file *file; + assert(class); file = xcalloc(1, class->size); + file->class = class; + file->proc = proc; INIT_LIST_HEAD(&file->files); @@ -639,11 +642,6 @@ static struct file *copy_file(struct file *old) static void file_set_path(struct file *file, struct stat *sb, const char *name, int association) { - const struct file_class *class = stat2class(sb); - - assert(class); - - file->class = class; file->association = association; file->name = xstrdup(name); file->stat = *sb; -- 2.47.3