Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove errno workaround introduced in #11 #14

Open
kshlm opened this issue Dec 7, 2015 · 2 comments
Open

Remove errno workaround introduced in #11 #14

kshlm opened this issue Dec 7, 2015 · 2 comments

Comments

@kshlm
Copy link
Member

kshlm commented Dec 7, 2015

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.

@prashanthpai
Copy link
Contributor

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

@esiqveland
Copy link

Did you ever figure this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants