【发布时间】:2012-07-09 14:01:46
【问题描述】:
在我的代码中,open() 失败,返回代码为 -1,但不知何故 errno 没有设置。
int fd;
int errno=0;
fd = open("/dev/tty0", O_RDWR | O_SYNC);
printf("errno is %d and fd is %d",errno,fd);
输出是
errno is 0 and fd is -1
为什么没有设置 errno?我如何确定open() 失败的原因?
【问题讨论】:
标签: c linux file-io linux-kernel errno