public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/4] Add stat04 test
Date: Wed, 10 Jul 2024 14:15:46 +0200	[thread overview]
Message-ID: <Zo57ckoV1LQwjVch@yuki> (raw)
In-Reply-To: <20240710-stat04-v3-1-c68a2324ad94@suse.com>

Hi!
> +static char symb_path[PATH_MAX];
> +static char file_path[PATH_MAX];
> +static struct stat *file_stat;
> +static struct stat *symb_stat;
> +static char *tmpdir;
> +
> +static void run(void)
> +{
> +	SAFE_STAT(file_path, file_stat);
> +	SAFE_STAT(symb_path, symb_stat);
> +
> +	TST_EXP_EQ_LI(file_stat->st_dev, symb_stat->st_dev);
> +	TST_EXP_EQ_LI(file_stat->st_mode, symb_stat->st_mode);
> +	TST_EXP_EQ_LI(file_stat->st_nlink, symb_stat->st_nlink);
> +	TST_EXP_EQ_LI(file_stat->st_uid, symb_stat->st_uid);
> +	TST_EXP_EQ_LI(file_stat->st_gid, symb_stat->st_gid);
> +	TST_EXP_EQ_LI(file_stat->st_size, symb_stat->st_size);
> +	TST_EXP_EQ_LI(file_stat->st_atime, symb_stat->st_atime);
> +	TST_EXP_EQ_LI(file_stat->st_mtime, symb_stat->st_mtime);
> +	TST_EXP_EQ_LI(file_stat->st_ctime, symb_stat->st_ctime);
> +}
> +
> +static void setup(void)
> +{
> +	char opt_bsize[32];
> +	const char *const fs_opts[] = {opt_bsize, NULL};
> +	struct stat sb;
> +	int pagesize;
> +	int fd;
> +
> +	tmpdir = tst_get_tmpdir();
> +
> +	if (strlen(tmpdir) >= (PATH_MAX - strlen(FILENAME))) {
> +		tst_brk(TCONF, "Temporary folder name is too long. "
> +			"Can't create file");
> +	}
> +
> +	if (strlen(tmpdir) >= (PATH_MAX - strlen(SYMBNAME))) {
> +		tst_brk(TCONF, "Temporary folder name is too long. "
> +			"Can't create symbolic link");
> +	}

Uff, this is so 1990. Can we please use asprintf() instead?


Other than that this looks good to me:

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

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2024-07-10 12:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  8:54 [LTP] [PATCH v3 0/4] symlink01 split Andrea Cervesato
2024-07-10  8:54 ` [LTP] [PATCH v3 1/4] Add stat04 test Andrea Cervesato
2024-07-10 12:15   ` Cyril Hrubis [this message]
2024-07-10 14:44   ` Petr Vorel
2024-07-10 15:14   ` Petr Vorel
2024-07-10  8:54 ` [LTP] [PATCH v3 2/4] Add lstat03 test Andrea Cervesato
2024-07-10 14:53   ` Petr Vorel
2024-07-10  8:54 ` [LTP] [PATCH v3 3/4] Add chmod08 test Andrea Cervesato
2024-07-10 15:12   ` Petr Vorel
2024-07-10  8:54 ` [LTP] [PATCH v3 4/4] Add open15 test Andrea Cervesato
2024-07-10  9:37   ` Li Wang
2024-07-10 14:39   ` 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=Zo57ckoV1LQwjVch@yuki \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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