Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site redwood.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!zehntel!dual!amdcad!fortune!rhino!redwood!rpw3
From: rpw3@redwood.UUCP (Rob Warnock)
Newsgroups: net.sources.bugs,net.unix
Subject: Re: Problem with patch and infinit directories
Message-ID: <124@redwood.UUCP>
Date: Wed, 16-Jan-85 01:02:07 EST
Article-I.D.: redwood.124
Posted: Wed Jan 16 01:02:07 1985
Date-Received: Sun, 20-Jan-85 07:56:29 EST
References: <792@enea.UUCP> <795@enea.UUCP> <4883@utzoo.UUCP> <1299@utah-gr.UUCP> <34@spar.UUCP>
Organization: [Consultant], Foster City, CA
Lines: 25
Xref: watmath net.sources.bugs:192 net.unix:3374

+---------------
| I also accidentally created a HARD link, using patch,...
|                  ... I wonder how could patch do such an evil thing?
| And just how is it possible for `root' to create such a directory in 4.2
| without writing to raw disc?
| -michael
+---------------

WARNING!!! It has ALWAYS been possible (on any UNIX I know) for a superuser
to create a (hard) link to a directory.  While the "ln" program (command) will
not allow it, the system call does (for the superuser) and must (for "mv").
Any program that runs as root and does not use 'system("/bin/ln ...")' for
making links (or 'system("mv ...")' for renaming) should have defensive code.

(It's actually useful, on occasion, to make a hard link to a directory, to
temporarily work around problems with hard-coded paths in binary programs.
This is not particularly a problem if you don't create a loop.)


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404