[PATCH 4/7] tests: Additional shmget decoder checks

Dmitry V. Levin ldv at altlinux.org
Thu Sep 8 10:45:58 UTC 2016


On Tue, Sep 06, 2016 at 05:08:36AM +0300, Eugene Syromyatnikov wrote:
> * tests/ipc_shm.c: Additional checks for shmget syscall decoding.
> ---
>  tests/ipc_shm.c |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c
> index 54723e2..80a8f0f 100644
> --- a/tests/ipc_shm.c
> +++ b/tests/ipc_shm.c
> @@ -27,11 +27,15 @@
>   */
>  
>  #include "tests.h"
> +#include <assert.h>
>  #include <errno.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <sys/shm.h>
>  
> +#include "xlat.h"
> +#include "xlat/shm_resource_flags.h"
> +
>  static int id = -1;
>  
>  static void
> @@ -45,9 +49,25 @@ cleanup(void)
>  int
>  main(void)
>  {
> +	static const key_t bogus_key = (key_t)0xeca86420fdb97531LLU;
> +	static const size_t bogus_size = 0xdec0ded1dec0ded2LLU;
> +	static const int bogus_flags = 0xface1e55;
> +
>  	int rc;
>  	struct shmid_ds ds;
>  
> +	assert(shmget(bogus_key, bogus_size, bogus_flags) == -1);
> +	printf("shmget\\(%#lx, %lu, %s%s%s%#x\\|%#04o\\) += %s\n",
> +		(unsigned long)((sizeof(key_t) == sizeof(int)) ?
> +		(unsigned)bogus_key : (unsigned long)bogus_key),
> +		bogus_size,

tests/ipc_shm.c:63:9: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka const unsigned int}' [-Werror=format=]
  printf("shmget\\(%#lx, %lu, %s%s%s%#x\\|%#04o\\) += %s\n",
         ^

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160908/bab51ee9/attachment.bin>


More information about the Strace-devel mailing list