#include #include #include #include #include #include #include #include int main(int argc, char **argv) { int fd; int rc; fd = open(".", O_RDONLY); if (fd < 0) { perror("opening '.' :"); exit(2); } rc = chdir("/mnt/lustre/subdir/subdir"); if (rc) { perror("cannot chdir subdir:"); exit(3); } rc = fchdir(fd); if (rc) { perror("cannot fchdir back\n"); exit(4); } rc = close(fd); if (rc) { perror("cannot close '.'\n"); exit(5); } return(0); }