fchdir_test.c
来自「lustre 1.6.5 source code」· C语言 代码 · 共 42 行
C
42 行
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>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);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?