Article View: comp.sys.intel
Article #1990Re: Unlinking files mimicing "rm -f"
From: Conor P. Cahill
Date: Sat, 03 Mar 1990 01:25
Date: Sat, 03 Mar 1990 01:25
30 lines
2052 bytes
2052 bytes
In article <2885@umbc3.UMBC.EDU> cs223130@umbc5.umbc.edu.UUCP (CMSC 223/01011) writes:
>The problem arises when
>a process running as joeblow wants to remove entries in "foodir" that
>are not owned by him. A regular call to unlink() prompts the user if
>they really want to remove the file. How do I disable this feature in
>a C program using UNIX system calls -vs- invoking "system("rm -f
This is not true. unlink(2) is a system call and it does not prompt the
user for anything. rm(1) has some special code that stats a file (or calls
access(2), whatever) to see if the current user doesn't have write access
to the file. If not rm(1) asks the user if it it ok to remove the file.
To unlink(2) a file, all you need is write permission in the directory
in which the file exists. The only exception that I know of is that in
some systems (namely system V.3+) if the sticky bit is set on a directory,
only those that own the file can remove them. Normally this is only set
for directories like /tmp.
>no user interaction whatsoever. This process runs on System V version
>2.2. (Yeah I know it's old but I have no say on upgrades) The machine
>is an AT&T 3b15. Any help with this would be greatly appreciated.
This is true for any current version of unix.
--
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.,
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
Technical Details
Message-ID:
<1990Mar3.012557.26485@virtech.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!uunet!virtech!cpcahilReferences:
<288@hitachi.uucp> <2885@umbc3.UMBC.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.sys.intel,comp.unix.i386,comp.unix.questions Subject: Re: Unlinking files mimicing "rm -f" Keywords: Unlinking Message-ID: <1990Mar3.012557.26485@virtech.uucp> Date: 3 Mar 90 01:25:57 GMT References: <288@hitachi.uucp> <2885@umbc3.UMBC.EDU> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Distribution: usa Organization: Virtual Technologies Inc., Sterling VA Lines: 30