home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 12888 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.7 KB  |  63 lines

  1. Path: sparky!uunet!amusing!lordbah
  2. From: lordbah@amusing.Bah.Rochester.NY.US (Jeff Van Epps)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: SAS 5.10 fopen weirdness
  5. Followup-To: comp.sys.amiga.programmer
  6. Distribution: world
  7. Reply-To: lordbah@amusing.Bah.Rochester.NY.US
  8. References: 
  9. Message-ID: <lordbah.1qs7@amusing.Bah.Rochester.NY.US>
  10. Date: 30 Aug 92 21:19:31 EDT
  11. Organization: Bah's News Club
  12. Lines: 49
  13.  
  14. I'm seeing bizarre behavior from fopen() in SAS 5.10.  Trying to open an
  15. unwritable file for writing, I expected an error.  Instead the file is
  16. deleted, then created (as shown by snoopdos).  I consider this just plain
  17. wrong.    It's certainly counter-intuitive, contrary to what UNIX does, and
  18. it doesn't say in the manual that it will do this.
  19.  
  20. Anyone know why, or if a new version fixes it, or (better yet) if there is
  21. a FREE bug fix?
  22.  
  23. ================ EXAMPLE ==============================
  24.  
  25. [Temporary:]: ll unwrite
  26. -----r-ed    1     0  Aug 30 20:33  unwrite
  27. [Temporary:]: cat foo.c
  28. #include <stdio.h>
  29.  
  30. main()
  31. {
  32. FILE *fp;
  33. extern int errno;
  34.  
  35. if ( ( fp = fopen( "unwrite", "w" ) ) == NULL )
  36.     {
  37.     perror( "unwrite" );
  38.     printf( "open failed, errno %d\n", errno );
  39.     }
  40. else
  41.     {
  42.     printf( "open succeeded?!?\n" );
  43.     fclose( fp );
  44.     }
  45. }
  46. [Temporary:]: ll unwrite
  47. -----rwed    1     0  Aug 30 20:36  unwrite
  48. [Temporary:]: chmod -d unwrite
  49. [Temporary:]: ll unwrite
  50. -----rwe-    1     0  Aug 30 20:36  unwrite
  51. [Temporary:]: foo
  52. open failed, errno 2
  53.  
  54. unwrite: No such file or directory
  55. [Temporary:]: ll unwrite
  56. -----rwe-    1     0  Aug 30 20:36  unwrite
  57.  
  58. ====================================================
  59.  
  60. --------------------------------------------------------------------
  61.     Jeff Van Epps    uunet!amusing!lordbah
  62.                      lordbah@amusing.Bah.Rochester.NY.US
  63.