zsh-workers
 help / color / mirror / code / Atom feed
* Cannot write to zsystem flock's descriptor
@ 2017-03-01 10:49 Sebastian Gniazdowski
  2017-03-01 17:32 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2017-03-01 10:49 UTC (permalink / raw)
  To: zsh-workers

Hello,

# echo "test" > file
# zsystem flock -t 0 -f MY_FD "file"; echo $?
0
# echo a>&${MY_FD}
zsh: 11: bad file descriptor
# exec {MY_FD}>&-
(works, lock also works)

I've added debug logs to system.c and there is:

Read-write flags, 2 (O_RDWR) | 131072 (O_NOCTTY) = 131074
Before move fdflags 0
After move fdflags 0
After cloexec fdflags 1
lck.l_type RD:1, WR:3, is:3

So it looks good. When locking via "flock" util-linux program I can
write to the FD. What could it be? 

    if ((flock_fd = open(unmeta(args[0]), flags)) < 0) {

flags are like first line of debug message. I think it's open() that
matters.

-- 
  Sebastian Gniazdowski
  psprint3@fastmail.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-01 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 10:49 Cannot write to zsystem flock's descriptor Sebastian Gniazdowski
2017-03-01 17:32 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).