Home | History | Annotate | Download | only in execlp
      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 (at) 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  */
     37 #include <errno.h>
     38 #include <string.h>
     39 #include <signal.h>
     40 #include <stdlib.h>
     41 
     42 #include <sys/types.h>
     43 #include <sys/wait.h>
     44 
     45 #include "test.h"
     46 
     47 static void setup(void);
     48 
     49 char *TCID = "execlp01";
     50 int TST_TOTAL = 1;
     51 
     52 int main(int ac, char **av)
     53 {
     54 	int lc;
     55 	pid_t pid;
     56 
     57 	tst_parse_opts(ac, av, NULL, NULL);
     58 
     59 	setup();
     60 
     61 	for (lc = 0; TEST_LOOPING(lc); lc++) {
     62 		switch (pid = FORK_OR_VFORK()) {
     63 		case 0:
     64 			execlp("execlp01_child", "execlp01_child", "canary", NULL);
     65 			tst_brkm(TFAIL | TERRNO, NULL,
     66 			         "Failed to execute execlp01_child");
     67 		case -1:
     68 			tst_brkm(TBROK | TERRNO, NULL, "fork failed");
     69 		default:
     70 			tst_record_childstatus(NULL, pid);
     71 		}
     72 	}
     73 
     74 	tst_exit();
     75 }
     76 
     77 static void setup(void)
     78 {
     79 	tst_sig(FORK, DEF_HANDLER, NULL);
     80 
     81 	TEST_PAUSE;
     82 }
     83