From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4] Add stat04 test
Date: Fri, 23 Feb 2024 16:47:32 +0100 [thread overview]
Message-ID: <20240223154732.GD1486515@pevik> (raw)
In-Reply-To: <b42a273b-5f57-4cd0-8dd9-03b14da9b7fd@suse.com>
Hi Andrea,
> > > + char *symname = "my_symlink0";
> > > + char *tmpdir = tst_get_tmpdir();
> > > +
> > > + SAFE_SYMLINK(tmpdir, symname);
> > > +
> > > + struct stat path;
> > > + struct stat link;
> > nit: maybe define struct at the top of the function?
> This is common in the first versions of C, but a good practice is to define
> variables as close as possible where they are used in order to improve
> readability.
Fair enough.
> > > +
> > > + TST_EXP_PASS(stat(tmpdir, &path));
> > > + free(tmpdir);
> > If SAFE_SYMLINK() fails, free() will not happen. I wonder if we should bother
> > (we'd have to set it NULL and add a cleanup function).
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > Kind regards,
> > Petr
...
> According to Cyril suggestions we are probably done with this patch so it
> can be merged. Isn't it?
Well you free() later in the function. But Cyril's note sounds reasonable for
me:
"call it once in the test setup() or use "." instead."
Could you please do it?
Also most of the tests really run tst_get_tmpdir() in the setup() (or cleanup(),
there are exceptions (new API: testcases/kernel/syscalls/pathconf/pathconf01.c,
old API: testcases/kernel/syscalls/symlink/symlink01.c,
testcases/kernel/syscalls/clone/clone02.c), which should be fixed.
IMHO tests which call tst_get_tmpdir() in the run()
Kind regards,
Petr
> Thanks,
> Andrea
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-02-23 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 15:36 [LTP] [PATCH v4] Add stat04 test Andrea Cervesato
2024-02-22 23:36 ` Petr Vorel
2024-02-23 11:09 ` Cyril Hrubis
2024-02-23 12:29 ` Andrea Cervesato via ltp
2024-02-23 15:47 ` Petr Vorel [this message]
2024-02-24 9:32 ` Andrea Cervesato via ltp
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=20240223154732.GD1486515@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.