[PATCH v2] tests/mknod.c: add workaround for ppc bug in travis

Dmitry V. Levin ldv at altlinux.org
Tue Aug 25 14:02:23 UTC 2020


On Tue, Aug 25, 2020 at 03:39:24PM +0200, Ákos Uzonyi wrote:
> On ppc travis builds syscall(mknod) sometimes does not fail with EEXISTS
> as expected, but returns successfully. This commit uses sprintrc for
> errno printing, which handles successful return values too.
> 
> * tests/mknod.c (call_mknod): set errno to 0 before syscall.
> (main): Use sprintrc for printing errno.
> ---
>  tests/mknod.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/mknod.c b/tests/mknod.c
> index 44c6f028..2570b523 100644
> --- a/tests/mknod.c
> +++ b/tests/mknod.c
> @@ -10,6 +10,7 @@
>  
>  #ifdef __NR_mknod
>  
> +# include <errno.h>
>  # include <stdio.h>
>  # include <sys/stat.h>
>  # include <sys/sysmacros.h>
> @@ -20,6 +21,7 @@ static const char *sample;
>  static long
>  call_mknod(unsigned short mode, unsigned long dev)
>  {
> +	errno = 0;
>  	unsigned long lmode = (unsigned long) 0xffffffffffff0000ULL | mode;
>  	return syscall(__NR_mknod, sample, lmode, dev);
>  }

I don't see why you might need to change this part.
Besides that, LGTM.


-- 
ldv


More information about the Strace-devel mailing list