summaryrefslogtreecommitdiff
path: root/410user/progs/exec_nonexist.c
blob: f2cb8dde8bcd920b3dc5a71ddfcc05cee8a9d78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/** @file 410user/progs/exec_nonexist.c
 *  @author mpa
 *  @brief Tests exec()ing a nonexistent file.
 *  @public yes
 *  @for p3
 *  @covers exec
 *  @status done
 */

#include <syscall.h>
#include <stdlib.h>
#include <stdio.h>
#include "410_tests.h"
#include <report.h>

DEF_TEST_NAME("exec_nonexist:");

int main() {
  char *name = "exec_a_random_file_that_does_not_exist";
  char *args[] = {name, 0};
  report_start(START_CMPLT);

  if (exec(name,args) >= 0) {
    report_misc("exec() did not return an error code");
    report_end(END_FAIL);
    exit(-1);
  }

  report_end(END_SUCCESS);
  exit(0);
}