gogfapi
gogfapi copied to clipboard
Remove errno workaround introduced in #11
PR #11 introduced a workaround to fix EINVAL being returned on successful writes. This is most likely a bug in gfapi, we need to file a bug for this and have it fixed. We need to remove the workaround from gogfapi once gfapi has the fix.
This also affects Fstat() (may be other APIs too)
package main
import (
"fmt"
"os"
"syscall"
"github.com/kshlm/gogfapi/gfapi"
)
func main() {
var errno syscall.Errno
var err error
v := new(gfapi.Volume)
v.Init("localhost", "test")
v.SetLogging("", gfapi.LogDebug)
v.Mount()
defer v.Unmount()
file, err := v.OpenFile("/whatever", os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
fmt.Printf("OpenFile() failed.%s\n", err.Error())
return
}
defer file.Close()
// Comment to see Stat() pass later without error
// Remove comment to see Stat() fail later with EINVAL
file.Write([]byte("yoyo"))
_, err = file.Stat()
if err != nil {
errno = err.(syscall.Errno)
fmt.Printf("Stat() failed. Errno: %d - %s\n", errno, err.Error())
return
}
}
Did you ever figure this out?