- 论坛徽章:
- 95
|
原帖由 天外飞客 于 2007-4-20 13:26 发表
[root@localhost work]# ll slink prog
-rwxr-xr-x 1 root root 12752 4月 19 23:25 prog
lrwxrwxrwx 1 root root 4 4月 20 12:44 slink -> prog
stat("slink",&statbuf);
显示的竟然是prog文件的信息.
而不是链接文件slink的信息..
如果你要查看 symbolic link 本身的信息,请用 lstat(3)。
如下是 stat(3) 手册中的一段:
If the named file is a symbolic link, the stat() function shall continue pathname resolution using the contents of the symbolic link, and shall return information pertaining to the resulting file if the file exists.
发贴前请先查阅文档。 |
|