Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: Neil Brown <neilb@suse.de>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files
Date: Fri, 11 Mar 2022 13:43:47 +0100	[thread overview]
Message-ID: <YitEA0Pot/ivUQa6@yuki> (raw)
In-Reply-To: <20220311110015.20951-1-pvorel@suse.cz>

Hi!
> Reported-by: Neil Brown <neilb@suse.de>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/nfs/nfs_stress/nfs01_open_files.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/network/nfs/nfs_stress/nfs01_open_files.c b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> index 9342f11ba9..c5627058dc 100644
> --- a/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> +++ b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> @@ -10,7 +10,8 @@
>  #include <sys/stat.h>
>  #include <unistd.h>
>  
> -#define TEMPLATE "ltpXXXXXX"
> +#define TEMPLATE_PREFIX "ltp"
> +#define TEMPLATE TEMPLATE_PREFIX "XXXXXX"
>  
>  int write_something(int);
>  void delete_files(void);
> @@ -101,7 +102,7 @@ void delete_files(void)
>  
>  	dirp = opendir(".");
>  	for (entp = readdir(dirp); entp; entp = readdir(dirp))
> -		if (!strncmp(entp->d_name, "apt", 3)) {
> +		if (!strncmp(entp->d_name, TEMPLATE_PREFIX, 3)) {

Maybe we should also do:

#define TEMPLATE_PREFIX_LEN (sizeof(TEMPLATE_PREFIX) - 1)

And use TEMPLATE_PREFIX_LEN instead of the hardcoded 3


Otherwise it looks obviously correct:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2022-03-11 12:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 11:00 [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files Petr Vorel
2022-03-11 11:08 ` Petr Vorel
2022-03-11 12:43 ` Cyril Hrubis [this message]
2022-03-11 14:50   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YitEA0Pot/ivUQa6@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=neilb@suse.de \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox