op_noacc.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /***********************************************************************
  6. **
  7. ** Name: op_noacc.c
  8. **
  9. ** Description: Test Program to verify the PR_NO_ACCESS_RIGHTS_ERROR in PR_Open
  10. **
  11. ** Modification History:
  12. ** 03-June-97 AGarcia- Initial version
  13. ***********************************************************************/
  14. /***********************************************************************
  15. ** Includes
  16. ***********************************************************************/
  17. /* Used to get the command line option */
  18. #include "prinit.h"
  19. #include "prmem.h"
  20. #include "prio.h"
  21. #include "prerror.h"
  22. #include <stdio.h>
  23. #include "plgetopt.h"
  24. static PRFileDesc *err01;
  25. PRIntn error_code;
  26. int main(int argc, char **argv)
  27. {
  28. #ifdef XP_PC
  29. printf("op_noacc: Test not valid on MS-Windows.\n\tNo concept of 'mode' on Open() call\n");
  30. return(0);
  31. #endif
  32. PR_STDIO_INIT();
  33. err01 = PR_Open("err01.tmp", PR_CREATE_FILE | PR_RDWR, 0);
  34. if (err01 == NULL) {
  35. int error = PR_GetError();
  36. printf ("error code is %d\n", error);
  37. if (error == PR_NO_ACCESS_RIGHTS_ERROR) {
  38. printf ("PASS\n");
  39. return 0;
  40. }
  41. }
  42. printf ("FAIL\n");
  43. return 1;
  44. }