op_noacc.c (1437B)
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 ** 8 ** Name: op_noacc.c 9 ** 10 ** Description: Test Program to verify the PR_NO_ACCESS_RIGHTS_ERROR in PR_Open 11 ** 12 ** Modification History: 13 ** 03-June-97 AGarcia- Initial version 14 ***********************************************************************/ 15 16 /*********************************************************************** 17 ** Includes 18 ***********************************************************************/ 19 /* Used to get the command line option */ 20 #include "prinit.h" 21 #include "prmem.h" 22 #include "prio.h" 23 #include "prerror.h" 24 #include <stdio.h> 25 #include "plgetopt.h" 26 27 static PRFileDesc* err01; 28 PRIntn error_code; 29 30 int main(int argc, char** argv) { 31 #ifdef XP_PC 32 printf( 33 "op_noacc: Test not valid on MS-Windows.\n\tNo concept of 'mode' on " 34 "Open() call\n"); 35 return (0); 36 #endif 37 38 err01 = PR_Open("err01.tmp", PR_CREATE_FILE | PR_RDWR, 0); 39 if (err01 == NULL) { 40 int error = PR_GetError(); 41 printf("error code is %d\n", error); 42 if (error == PR_NO_ACCESS_RIGHTS_ERROR) { 43 printf("PASS\n"); 44 return 0; 45 } 46 } 47 printf("FAIL\n"); 48 return 1; 49 }