(root)/
strace-6.5/
tests/
zeroargc.c
       1  /*
       2   * Execute an executable with zero argc and specified environment.
       3   *
       4   * Copyright (c) 2017-2018 Dmitry V. Levin <ldv@strace.io>
       5   * Copyright (c) 2017-2020 The strace developers.
       6   * All rights reserved.
       7   *
       8   * SPDX-License-Identifier: GPL-2.0-or-later
       9   */
      10  
      11  #include "tests.h"
      12  #include <stdlib.h>
      13  #include <unistd.h>
      14  
      15  int
      16  main(const int ac, char **const av)
      17  {
      18  	if (ac < 2)
      19  		error_msg_and_fail("missing operand");
      20  	const char *const path = av[1];
      21  	av[1] = 0;
      22  	execve(path, av + 1, av + 2);
      23  	perror_msg_and_fail("execve: %s", path);
      24  }