Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Branch: b1_4
[fs/lustre-release.git]
/
lustre
/
tests
/
fchdir_test.c
1
#include <stdlib.h>
2
#include <stdio.h>
3
#include <string.h>
4
#include <errno.h>
5
#include <sys/stat.h>
6
#include <sys/types.h>
7
#include <unistd.h>
8
#include <fcntl.h>
9
10
11
int main(int argc, char **argv)
12
{
13
int fd;
14
int rc;
15
16
fd = open(".", O_RDONLY);
17
if (fd < 0) {
18
perror("opening '.' :");
19
exit(2);
20
}
21
22
rc = chdir("/mnt/lustre/subdir/subdir");
23
if (rc) {
24
perror("cannot chdir subdir:");
25
exit(3);
26
}
27
28
rc = fchdir(fd);
29
if (rc) {
30
perror("cannot fchdir back\n");
31
exit(4);
32
}
33
34
rc = close(fd);
35
if (rc) {
36
perror("cannot close '.'\n");
37
exit(5);
38
}
39
40
return(0);
41
}