[LTP] [PATCH] open_posix: Remove hardcoded /tmp

Li Wang liwang@redhat.com
Wed Mar 17 07:02:56 CET 2021


Joerg Vehlow <lkml@jv-coder.de> wrote:

...
>
>  int main(void)
>  {
> -       char tmpfname[256];
> +       char tmpfname[PATH_MAX];
>  #define BUF_SIZE 1024
>         char buf[BUF_SIZE];
>         struct timespec processing_completion_ts = {0, 10000000};
> @@ -46,8 +47,7 @@ int main(void)
>         if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
>                 return PTS_UNSUPPORTED;
>
> -       snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_1_1_%d",
> -                getpid());
> +       LTP_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_1_1");
>

It'd be great if a passing string end with the suffix "_", be used to
clearly distinguish the PID number.

Something like:
    LTP_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_1_1_");

This comment applies to all of the changing files in this patch, or we can
modify it in the macro prototype.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210317/c2bc4588/attachment.htm>


More information about the ltp mailing list