home *** CD-ROM | disk | FTP | other *** search
- From: zodiac@darkness.gun.de (Ralph Seichter)
- Subject: Re: SAS/C fopen("foo","a") -- is this a bug?
- Date: Thu, 15 Feb 96 12:13:43 CET
- Message-ID: <zp547aaCHJYPZ1@da23.darkness.gun.de>
- X-ZC-PGP-KEY-AVAIL:
- Path: tim.xenologics.com!darkness.gun.de
- X-ZC-F-TO: Matthias Meixner
- X-Newsreader: Zodiac's Point 37.208 [REGISTERED 0001] via Connectline-CLMSortin 2.25
- Newsgroups: comp.sys.amiga.programmer
- X-Gateway: ZConnect DA darkness.gun.de [Connectline/AmigaOS]
- References: <zpfaa8aCCygGZ1@da23.darkness.gun.de> <4feh2j$7im@castle.nando.net> <zpfaa8aCGrYkZ1@da23.darkness.gun.de> <4fs8t3$12hp@rs18.hrz.th-darmstadt.de>
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- Mime-Version: 1.0
-
- On 14.02.96, meixner@rbg.informatik.th-darmstadt.de (Matthias Meixner) wrote
-
- > : You mean you can actually write into a write protected file?
- >
- > There are even worse things in V39: you can change the date of a file
- > even if the disk is locked with "lock":
-
- Steve Krueger has made me aware of a bug in the ram-handler, which I can
- easily (and unfortunately) reproduce with Kickstart 40.68. Compile the
- following test program, and then do:
-
- 1> date >foo
- 1> protect foo r
- 1> test3
-
- On a hard disk, -1 is returned to indicate a write error, as expected. But
- if you do the same in your RAM disk, Write() will actually write into the
- write protected file "foo". That's really shocking!
-
- ----------8<----------8<----------8<----------8<----------8<----------
- /* test3.c */
-
- #include <proto/dos.h>
-
- int main(void)
- {
- BPTR file;
-
- if (file = Open("foo", MODE_READWRITE))
- {
- (void)Seek(file, 0, OFFSET_END);
- Printf("Write() returned %ld\n", Write(file, "bar\n", 4));
- Close(file);
- }
- else
- Printf("Open() failed\n");
- return(0);
- }
- ----------8<----------8<----------8<----------8<----------8<----------
-
- -Ralph
- --
- "Fⁿr manche ist es ein Stⁿck Schei▀e, fⁿr andere
- die lΣngste Praline der Welt." (Walter Moers)
-