• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  *    AUTHOR		: William Roske
4  *    CO-PILOT		: Dave Fenner
5  *    DATE STARTED	: 06/01/02
6  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of version 2 of the GNU General Public License as
10  * published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it would be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * Further, this software is distributed without any warranty that it is
17  * free of the rightful claim of any third person regarding infringement
18  * or the like.  Any license provided herein, whether implied or
19  * otherwise, applies only to this software file.  Patent licenses, if
20  * any, provided herein do not apply to combinations of this program with
21  * other software, or any other product whatsoever.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, write the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26  *
27  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
28  * Mountain View, CA  94043, or:
29  *
30  * http://www.sgi.com
31  *
32  * For further information regarding this notice, see:
33  *
34  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
35  */
36 #include <sys/types.h>
37 #include <sys/wait.h>
38 #include <errno.h>
39 #include <string.h>
40 #include <signal.h>
41 #include <stdlib.h>
42 
43 #include "test.h"
44 
45 static void setup(void);
46 
47 char *TCID = "execvp01";
48 int TST_TOTAL = 1;
49 
main(int ac,char ** av)50 int main(int ac, char **av)
51 {
52 	int lc;
53 	pid_t pid;
54 	char *const args[] = {"execvp01_child", "canary", NULL};
55 
56 	tst_parse_opts(ac, av, NULL, NULL);
57 
58 	setup();
59 
60 	for (lc = 0; TEST_LOOPING(lc); lc++) {
61 		switch (pid = FORK_OR_VFORK()) {
62 		case 0:
63 			execvp("execvp01_child", args);
64 			tst_brkm(TFAIL | TERRNO, NULL,
65 			         "Failed to execute execvp01_child");
66 		case -1:
67 			tst_brkm(TBROK | TERRNO, NULL, "fork failed");
68 		default:
69 			tst_record_childstatus(NULL, pid);
70 		}
71 	}
72 
73 	tst_exit();
74 }
75 
setup(void)76 static void setup(void)
77 {
78 	tst_sig(FORK, DEF_HANDLER, NULL);
79 
80 	TEST_PAUSE;
81 }
82