From: Masatake YAMATO Date: Sun, 4 Jun 2023 21:39:26 +0000 (+0900) Subject: lsfd: assign a class to the file in new_file() X-Git-Tag: v2.40-rc1~402^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2beb17a6417cab1d4ebc9cb885938536be4e9cc7;p=thirdparty%2Futil-linux.git lsfd: assign a class to the file in new_file() Signed-off-by: Masatake YAMATO --- 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;