nsprpub/pr/tests/op_noacc.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/tests/op_noacc.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/***********************************************************************
    1.10 +**
    1.11 +** Name: op_noacc.c
    1.12 +**
    1.13 +** Description: Test Program to verify the PR_NO_ACCESS_RIGHTS_ERROR in PR_Open
    1.14 +**
    1.15 +** Modification History:
    1.16 +** 03-June-97 AGarcia- Initial version
    1.17 +***********************************************************************/
    1.18 +
    1.19 +/***********************************************************************
    1.20 +** Includes
    1.21 +***********************************************************************/
    1.22 +/* Used to get the command line option */
    1.23 +#include "prinit.h"
    1.24 +#include "prmem.h"
    1.25 +#include "prio.h"
    1.26 +#include "prerror.h"
    1.27 +#include <stdio.h>
    1.28 +#include "plgetopt.h"
    1.29 +
    1.30 +static PRFileDesc *err01;
    1.31 +PRIntn error_code;
    1.32 +
    1.33 +int main(int argc, char **argv)
    1.34 +{
    1.35 +#ifdef XP_PC
    1.36 +    printf("op_noacc: Test not valid on MS-Windows.\n\tNo concept of 'mode' on Open() call\n");
    1.37 +    return(0);
    1.38 +#endif
    1.39 +
    1.40 +
    1.41 +    PR_STDIO_INIT();
    1.42 +    err01 = PR_Open("err01.tmp", PR_CREATE_FILE | PR_RDWR, 0);
    1.43 +    if (err01 == NULL) {
    1.44 +        int error = PR_GetError();
    1.45 +        printf ("error code is %d\n", error);
    1.46 +        if (error == PR_NO_ACCESS_RIGHTS_ERROR) {
    1.47 +            printf ("PASS\n");
    1.48 +            return 0;
    1.49 +        }
    1.50 +    }
    1.51 +    printf ("FAIL\n");
    1.52 +    return 1;
    1.53 +}
    1.54 +

mercurial