1
0
mirror of https://github.com/golang/go synced 2024-11-12 04:30:22 -07:00

fstat used wrong system call, lstat used wrong type of name

R=rsc
DELTA=7  (4 added, 0 deleted, 3 changed)
OCL=24617
CL=24617
This commit is contained in:
Rob Pike 2009-02-06 17:10:30 -08:00
parent d8a764cc7e
commit 69c41d7f5f

View File

@ -65,13 +65,17 @@ func Stat(name string, buf *Stat_t) (ret int64, errno int64) {
return r1, err;
}
func Lstat(name *byte, buf *Stat_t) (ret int64, errno int64) {
r1, r2, err := Syscall(SYS_LSTAT, int64(uintptr(unsafe.Pointer(name))), int64(uintptr(unsafe.Pointer(buf))), 0);
func Lstat(name string, buf *Stat_t) (ret int64, errno int64) {
var namebuf [nameBufsize]byte;
if !StringToBytes(namebuf, name) {
return -1, ENAMETOOLONG
}
r1, r2, err := Syscall(SYS_LSTAT64, int64(uintptr(unsafe.Pointer(&namebuf[0]))), int64(uintptr(unsafe.Pointer(buf))), 0);
return r1, err;
}
func Fstat(fd int64, buf *Stat_t) (ret int64, errno int64) {
r1, r2, err := Syscall(SYS_FSTAT, fd, int64(uintptr(unsafe.Pointer(buf))), 0);
r1, r2, err := Syscall(SYS_FSTAT64, fd, int64(uintptr(unsafe.Pointer(buf))), 0);
return r1, err;
}