]> granicus.if.org Git - strace/blob - tests/rename.c
tests: add rename.test
[strace] / tests / rename.c
1 #include "tests.h"
2 #include <errno.h>
3 #include <sys/syscall.h>
4
5 #ifdef __NR_rename
6
7 # include <stdio.h>
8 # include <unistd.h>
9
10 # define OLD_FILE "rename_old"
11 # define NEW_FILE "rename_new"
12
13 int
14 main(void)
15 {
16         int rc = syscall(__NR_rename, OLD_FILE, NEW_FILE);
17         printf("rename(\"%s\", \"%s\") = %d %s (%m)\n",
18                OLD_FILE, NEW_FILE, rc,
19                errno == ENOSYS ? "ENOSYS" : "ENOENT");
20
21         puts("+++ exited with 0 +++");
22         return 0;
23 }
24
25 #else
26
27 SKIP_MAIN_UNDEFINED("__NR_rename")
28
29 #endif