1ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#include <stdio.h> 2ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#include <stdlib.h> 3ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#include <unistd.h> 4ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 5ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownint main(int argc, char **argv) 6ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown{ 7ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown if (argc == 1) 8ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown { 9ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown // This tests the case where argv and envp are NULL, which is easy to 10ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown // get wrong because it's an unusual case. 11663860b1408516d02ebfcb3a9999a134e6cfb223Ben Cheng if (execve("/bin/true", NULL, NULL) < 0) 12ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown { 13ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown perror("execve"); 14ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown exit(1); 15ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown } 16ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown } 17ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 18ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown exit(0); 19ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown} 20