(root)/
strace-6.5/
tests-mx32/
xattr-strings.c
       1  /*
       2   * Copyright (c) 2016-2018 The strace developers.
       3   * All rights reserved.
       4   *
       5   * SPDX-License-Identifier: GPL-2.0-or-later
       6   */
       7  
       8  #include "tests.h"
       9  
      10  #ifdef HAVE_SYS_XATTR_H
      11  
      12  # include <stdio.h>
      13  # include <sys/xattr.h>
      14  
      15  int
      16  main(void)
      17  {
      18  	static const char name[] = "strace.test";
      19  	static const char c_value[] = "foobar";
      20  
      21  	const char *const z_value = tail_memdup(c_value, sizeof(c_value));
      22  	long rc;
      23  
      24  	rc = fsetxattr(-1, name, z_value, sizeof(c_value), XATTR_REPLACE);
      25  	printf("fsetxattr(-1, \"%.*s\"..., \"%.*s\"..., %u, XATTR_REPLACE) = %s\n",
      26  	       4, name, 4, c_value, (unsigned) sizeof(c_value), sprintrc(rc));
      27  
      28  
      29  	puts("+++ exited with 0 +++");
      30  	return 0;
      31  }
      32  
      33  #else
      34  
      35  SKIP_MAIN_UNDEFINED("HAVE_SYS_XATTR_H")
      36  
      37  #endif