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 pid file failed, if pid file name is longer than 64 on Linux #16

Closed
jiedo opened this issue Oct 12, 2016 · 1 comment
Closed

Comments

@jiedo
Copy link

jiedo commented Oct 12, 2016

Hi,

I find a problem, the pid file is left over after program exit . I check the code and find the file name is truncated.

syscall.Unlink(name) 

The size of symbolic link file in /proc is always 64, this buf may not longer enough.

    if fi, err = os.Lstat(path); err != nil {
        return
    }
    buf := make([]byte, fi.Size()+1)

    if n, err = syscall.Readlink(path, buf); err == nil {
        name = string(buf[:n])
    }

Thanks!

@sevlyar
Copy link
Owner

sevlyar commented May 18, 2017

Many thanks for the report!

@sevlyar sevlyar closed this as completed May 18, 2017
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

2 participants