nsprpub/pr/tests/op_noacc.c

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial