home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!amusing!lordbah
- From: lordbah@amusing.Bah.Rochester.NY.US (Jeff Van Epps)
- Newsgroups: comp.sys.amiga.programmer
- Subject: SAS 5.10 fopen weirdness
- Followup-To: comp.sys.amiga.programmer
- Distribution: world
- Reply-To: lordbah@amusing.Bah.Rochester.NY.US
- References:
- Message-ID: <lordbah.1qs7@amusing.Bah.Rochester.NY.US>
- Date: 30 Aug 92 21:19:31 EDT
- Organization: Bah's News Club
- Lines: 49
-
- I'm seeing bizarre behavior from fopen() in SAS 5.10. Trying to open an
- unwritable file for writing, I expected an error. Instead the file is
- deleted, then created (as shown by snoopdos). I consider this just plain
- wrong. It's certainly counter-intuitive, contrary to what UNIX does, and
- it doesn't say in the manual that it will do this.
-
- Anyone know why, or if a new version fixes it, or (better yet) if there is
- a FREE bug fix?
-
- ================ EXAMPLE ==============================
-
- [Temporary:]: ll unwrite
- -----r-ed 1 0 Aug 30 20:33 unwrite
- [Temporary:]: cat foo.c
- #include <stdio.h>
-
- main()
- {
- FILE *fp;
- extern int errno;
-
- if ( ( fp = fopen( "unwrite", "w" ) ) == NULL )
- {
- perror( "unwrite" );
- printf( "open failed, errno %d\n", errno );
- }
- else
- {
- printf( "open succeeded?!?\n" );
- fclose( fp );
- }
- }
- [Temporary:]: ll unwrite
- -----rwed 1 0 Aug 30 20:36 unwrite
- [Temporary:]: chmod -d unwrite
- [Temporary:]: ll unwrite
- -----rwe- 1 0 Aug 30 20:36 unwrite
- [Temporary:]: foo
- open failed, errno 2
-
- unwrite: No such file or directory
- [Temporary:]: ll unwrite
- -----rwe- 1 0 Aug 30 20:36 unwrite
-
- ====================================================
-
- --------------------------------------------------------------------
- Jeff Van Epps uunet!amusing!lordbah
- lordbah@amusing.Bah.Rochester.NY.US
-