[LTP] [PATCH v5 1/5] Add SAFE_SYMLINKAT macro

Petr Vorel pvorel@suse.cz
Fri Aug 2 11:47:32 CEST 2024


Hi Andrea,

> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>  include/safe_macros_fn.h  |  4 ++++
>  include/tst_safe_macros.h |  3 +++
>  lib/safe_macros.c         | 20 ++++++++++++++++++++
>  3 files changed, 27 insertions(+)

> diff --git a/include/safe_macros_fn.h b/include/safe_macros_fn.h
> index d256091b7..6d9e72e4f 100644
> --- a/include/safe_macros_fn.h
> +++ b/include/safe_macros_fn.h
> @@ -122,6 +122,10 @@ int safe_symlink(const char *file, const int lineno,
>                   void (cleanup_fn)(void), const char *oldpath,
>                   const char *newpath);

> +int safe_symlinkat(const char *file, const int lineno,
> +                 void (cleanup_fn)(void), const char *oldpath,
> +                 const int newdirfd, const char *newpath);
> +

IMHO we agreed that we don't touch legacy API unless really needed.
If I remember correctly (I'm sorry I don't have a link), Cyril was not against
modifying lib/safe_macros.c (I would be against there is no need to touch old
API at all), but he was against exposing safe_symlinkat() in old API headers.

@Cyril correct me please if I'm wrong.
@Andrea if not, would you mind to move things to include/tst_safe_macros.h
and lib/tst_safe_macros.c?

The code itself is correct.

Kind regards,
Petr


More information about the ltp mailing list