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

styx.Topen flags are 0 on write? #36

Open
aep opened this issue Feb 4, 2023 · 1 comment
Open

styx.Topen flags are 0 on write? #36

aep opened this issue Feb 4, 2023 · 1 comment

Comments

@aep
Copy link

aep commented Feb 4, 2023

not sure if this is correct and i'm just confused?

case styx.Topen:                                        
    f, err := os.OpenFile(p, msg.Flag , 0777)              
    log.Println("Open", p, msg.Flag, err)      
    msg.Ropen(f, err)     

indicates Flag is always 0, so that when i do

./9pfuse localhost ~/mnt
echo bla > ~/mnt/bar

bar is just an empty file. presumably because it would require O_RDWR to actually write anything

@aep
Copy link
Author

aep commented Feb 4, 2023

just appening O_RDWR if its not a dir works, but i'm not sure if this is correct

			case styx.Topen:

				s, err := os.Stat(p)
				if err != nil {
					continue
				}

				var f *os.File
				if s.IsDir() {
					f, err  = os.OpenFile(p, msg.Flag , 0777)
				} else {
					f ,err  = os.OpenFile(p, msg.Flag | os.O_RDWR , 0777)
				}
				log.Println("Open file", p, msg.Flag, err)
				msg.Ropen(f, err)

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

1 participant