Commit 995b283b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: use syscall in TestNlinkZero

parent 6fad53e3
...@@ -395,14 +395,14 @@ func TestNlinkZero(t *testing.T) { ...@@ -395,14 +395,14 @@ func TestNlinkZero(t *testing.T) {
t.Fatalf("WriteFile: %v", err) t.Fatalf("WriteFile: %v", err)
} }
f, err := os.Open(dst) f, err := syscall.Open(dst, 0, 0)
if err != nil { if err != nil {
t.Fatalf("Open: %v", err) t.Fatalf("Open: %v", err)
} }
defer f.Close() defer syscall.Close(f)
var st syscall.Stat_t var st syscall.Stat_t
if err := syscall.Fstat(int(f.Fd()), &st); err != nil { if err := syscall.Fstat(f, &st); err != nil {
t.Errorf("Fstat before: %v", err) t.Errorf("Fstat before: %v", err)
} else if st.Nlink != 1 { } else if st.Nlink != 1 {
t.Errorf("Nlink of file: got %d, want 1", st.Nlink) t.Errorf("Nlink of file: got %d, want 1", st.Nlink)
...@@ -412,7 +412,7 @@ func TestNlinkZero(t *testing.T) { ...@@ -412,7 +412,7 @@ func TestNlinkZero(t *testing.T) {
t.Fatalf("Rename: %v", err) t.Fatalf("Rename: %v", err)
} }
if err := syscall.Fstat(int(f.Fd()), &st); err != nil { if err := syscall.Fstat(f, &st); err != nil {
t.Errorf("Fstat after: %v", err) t.Errorf("Fstat after: %v", err)
} else if st.Nlink != 0 { } else if st.Nlink != 0 {
t.Errorf("Nlink of overwritten file: got %d, want 0", st.Nlink) t.Errorf("Nlink of overwritten file: got %d, want 0", st.Nlink)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment