static int remove_empty(void) { int rv; report_begin("remove() on empty string"); rv = remove(""); return report_check2(rv, errno, EISDIR, EINVAL); }
static int remove_dotdot(void) { int rv; report_begin("remove() on .."); rv = remove(".."); return report_check2(rv, errno, EISDIR, EINVAL); }
static int sbrk_unalignedpos(void) { int result; report_begin("sbrk unaligned positive"); result = try_sbrk(17); return report_check2(result, errno, 0, EINVAL); }
static void rmdir_dotdot(void) { int rv; report_begin("rmdir .."); rv = rmdir(".."); report_check2(rv, errno, EINVAL, ENOTEMPTY); }
static int symlink_empty1(void) { int rv; int result; report_begin("symlink -> empty string"); rv = symlink("", TESTLINK); result = report_check2(rv, errno, 0, EINVAL); remove(TESTLINK); return result; }
static void chdir_empty(void) { int rv; /* * This is actually valid by some interpretations. */ report_begin("chdir to empty string"); rv = chdir(""); report_check2(rv, errno, EINVAL, 0); }
static int open_empty(void) { int rv; int result; report_begin("open empty string"); rv = open("", O_RDONLY); result = report_check2(rv, errno, 0, EINVAL); if (rv>=0) { close(rv); } return result; }
static int wait_badpid(pid_t pid, const char *desc) { pid_t rv; int x; int err; report_begin(desc); rv = waitpid(pid, &x, 0); err = errno; /* Allow ENOSYS for 0 or negative values of pid only */ if (pid <= 0 && rv == -1 && err == ENOSYS) { err = ESRCH; } else if (err == ENOSYS) { report_saw_enosys(); } return report_check2(rv, err, ESRCH, ECHILD); }
static int exec_emptyprog(void) { int rv; int result; char *args[2]; args[0] = (char *)"foo"; args[1] = NULL; if (exec_common_fork(&result) != 0) { return result; } report_begin("exec the empty string"); rv = execv("", args); result = report_check2(rv, errno, EINVAL, EISDIR); int code = result ? result : MAGIC_STATUS; exit(code); }