]> git.lizzy.rs Git - plan9front.git/commit
upas/marshal: handle nonexistent save folder correctly (thanks sirjofri)
authorOri Bernstein <ori@eigenstate.org>
Sat, 20 Feb 2021 20:49:03 +0000 (12:49 -0800)
committerOri Bernstein <ori@eigenstate.org>
Sat, 20 Feb 2021 20:49:03 +0000 (12:49 -0800)
commit245264e3716c46a5278f705c90d9cb24afca0924
treec6811a38f1a8bfbeec8ff787b6226b797c8cef01
parentdab168e6bd204c3cffae263d232051a47442c5ce
upas/marshal: handle nonexistent save folder correctly (thanks sirjofri)

When the save folder did not exist, and we could not create
it, we would handle up to one Biobuf worth of message, and
then fail, due to a failed tee. The sequence of events leading
up to this was:

openfolder() -> error
tee(0, fd, -1) -> wait for read
write(0, data) ->
write(fd, data) -> ok
write(-1, data) -> error, tee terminates
write(0, attachment) -> error

This change prevents us from writing to a closed fd, and
therefore from erroring out when sending.

We also warn the user.
sys/src/cmd/upas/marshal/marshal.c