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