🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #639

POSIX and symbolic links

#639
From: Sean Fagan
Date: Wed, 07 Nov 1990 21:55
31 lines
1622 bytes
Submitted-by: seanf@sco.COM (Sean Fagan)

I've been reading the September 1990 draft of 1003.1a (D4), and have a
question about symbolic links.  The draft specifies that an open of a file
"foo" shall fail if opened with O_CREAT and O_EXCL *both* set (which makes
sense).

But what happens if only O_CREAT is set?  To make it interesting, let's
throw in O_TRUNC as well.  That is:

	fd = open ("foo", O_CREAT|O_TRUNC|O_WRONLY, 0666);

Will the system follow the link, truncating whatever foo points to, if it
exists, or creating it otherwise, or will it truncate foo, creating a
regular file called "foo" with mode 0666&~umask?

My initial guess was that it would follow the link.  However, I can think of
cases where you would not want it to do so (someone then prompted, "Well, if
the sticky bit of the symlink is set, then..." 8-)).

Thanks...

-- 
-----------------+
Sean Eric Fagan  | "*Never* knock on Death's door:  ring the bell and 
seanf@sco.COM    |   run away!  Death hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.


Volume-Number: Volume 22, Number 20
Technical Details
Message-ID: <14450@cs.utexas.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!jbc

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!jbc
From: seanf@sco.COM (Sean Fagan)
Newsgroups: comp.std.unix
Subject: POSIX and symbolic links
Message-ID: <14450@cs.utexas.edu>
Date: 7 Nov 90 21:55:44 GMT
Sender: jbc@cs.utexas.edu
Organization: The Santa Cruz Operation, Inc.
Lines: 31
Approved: jbc@cs.utexas.edu (Guest Moderator, J.B.Chambers)
X-Submissions: std-unix@uunet.uu.net