gogfapi icon indicating copy to clipboard operation
gogfapi copied to clipboard

Remove errno workaround introduced in #11

Open kshlm opened this issue 9 years ago • 2 comments

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.

kshlm avatar Dec 07 '15 05:12 kshlm

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
    }
}


prashanthpai avatar Dec 07 '15 09:12 prashanthpai

Did you ever figure this out?

esiqveland avatar Aug 10 '18 17:08 esiqveland