drs@cerc.wvu.wvnet.edu (Darrell Schiebel) (06/30/89)
I am attempting to create a named pipe which several different users can read from and write to, but when I create the pipe with: if (mknod(destination_path,S_IFIFO | 0666, 0) == -1) if (errno != EEXIST) return(-1); else errno = 0; sock = open(destination_path,O_RDWR); the system creates a pipe with owner r/w, group r, and world r. The protection I was expecting is owner r/w , group r/w, wnd world r/w. Any Suggestions ? Thank You, Darrell Schiebel ------------------------------------------------------------------------- Darrell Schiebel _ _ _ __ __ drs@cerc.wvu.wvnet.edu | \ /\ |_) |_) |_ | | (_ Concurrent Engineering Center |_/ /--\ | \ | \ |__ |__ |__ __) :: West Virginia University -------------------------------------------------------------------------
bill@twwells.com (T. William Wells) (07/02/89)
In article <163@cerc.wvu.wvnet.edu.edu> drs@cerc.wvu.wvnet.edu (Darrell Schiebel) writes:
: I am attempting to create a named pipe which several different users
: can read from and write to, but when I create the pipe with:
:
: if (mknod(destination_path,S_IFIFO | 0666, 0) == -1)
: if (errno != EEXIST)
: return(-1);
: else errno = 0;
:
: sock = open(destination_path,O_RDWR);
:
: the system creates a pipe with owner r/w, group r, and world r. The
: protection I was expecting is owner r/w , group r/w, wnd world r/w.
Surround your code with something like:
savemask = umask(0);
...
(void)umask(savemask);
after, RTFM'ing.
BTW, it looks like you are trying to be clever with errno. Don't. The
only thing you are guaranteed by the documentation is that it is set
properly after a system call returns an error. For all you know, errno
could be set to a random value on success.
---
Bill { uunet | novavax | ankh | sunvice } !twwells!bill
bill@twwells.com
amitc@cbnewsl.ATT.COM (amit.chatterjee) (07/02/89)
In article <163@cerc.wvu.wvnet.edu.edu> drs@cerc.wvu.wvnet.edu (Darrell Schiebel) writes: >I am attempting to create a named pipe which several different users >can read from and write to, but when I create the pipe with: > > if (mknod(destination_path,S_IFIFO | 0666, 0) == -1) >...... > >the system creates a pipe with owner r/w, group r, and world r. The >protection I was expecting is owner r/w , group r/w, wnd world r/w. > Looks like your umask is set to 022. I believe that regardless of what you specify as the permission string in your system call, umask takes effect. -Amit ======================================================================= Amit Chatterjee (201) 271-1130 AT&T CSIL {major gateway}!tarpon!amit Somerset, NJ amit@tarpon.att.com =======================================================================
gwyn@smoke.BRL.MIL (Doug Gwyn) (07/02/89)
In article <163@cerc.wvu.wvnet.edu.edu> drs@cerc.wvu.wvnet.edu (Darrell Schiebel) writes: >Any Suggestions ? yeah -- set the umask to 0 first.