Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 18 Apr 2012 22:40:17 -0500 From: "Joe Shead" Newsgroups: comp.os.linux.development.apps References: Subject: Re: fopen() of a read-only file for writing? Date: Wed, 18 Apr 2012 22:40:32 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.2001 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001 Message-ID: Lines: 37 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.230.120.236 X-Trace: sv3-koze03oFdwDF2WOBSOU90mFhpWhsscenz93UCDZzHCm02kMimSkbR4eiGgjYyLsB7lCwlosZCQojxfo!seHlQ57N/sgEsHmEJmevwsMhvtlq1zu3+YUg+e1drro3jzOIix8zZpZdwP1wvxQpJeuLZSV2kCM0!zz662spX0mPptmiSzdmJSEwKInILg1KUPA== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2358 Xref: csiph.com comp.os.linux.development.apps:462 I tested it, and it works. With a new non-root user, I got the EACCES that I expected. I'll just say, for anyone out there who wants to read my humble opinion, that sometimes root wants to set things (like relatively stable C++ code, or an initialization script) to read-only, so he knows that if he opens those files to take a look, he can't easily accidentally modify them. If he wants to change the file, he would actually like to be forced to do a chmod, make the deliberate changes, and then chmod it back to read-only. I do that all the time. Thanks for the informed and comprehending help, though, Joe "Alan Curry" wrote in message news:jmiu3v$is7$1@speranza.aioe.org... > In article , > Joe Shead wrote: > > > >Hi, > > > >I have a file that has no write permissions on it, called readonly.txt. > >I am logged on as root. > > Read and write permissions mean nothing to root. > > Execute permission does matter though. I suspect that's a holdover from the > time when it was common for $PATH to contain "." so there was more potential > to accidentally execute things. > > -- > Alan Curry