nsprpub/pr/tests/op_filnf.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     6 /***********************************************************************
     7 **
     8 ** Name: op_filnf.c
     9 **
    10 ** Description: Test Program to verify the PR_FILE_NOT_FOUND_ERROR
    11 **				This test program also uses the TRUNCATE option
    12 **
    13 ** Modification History:
    14 ** 03-June-97 AGarcia- Initial version
    15 ***********************************************************************/
    17 /***********************************************************************
    18 ** Includes
    19 ***********************************************************************/
    20 /* Used to get the command line option */
    21 #include "prinit.h"
    22 #include "prmem.h"
    23 #include "prio.h"
    24 #include "prerror.h"
    25 #include <stdio.h>
    26 #include "plgetopt.h"
    28 static PRFileDesc *t1;
    29 PRIntn error_code;
    31 int main(int argc, char **argv)
    32 {
    33     PR_STDIO_INIT();
    34 	t1 = PR_Open("/usr/tmp/ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666);
    35 	if (t1 == NULL) {
    36 		if (PR_GetError() == PR_FILE_NOT_FOUND_ERROR) {
    37 				printf ("error code is %d \n", PR_GetError());
    38 				printf ("PASS\n");
    39 				return 0;
    40 		}
    41 		else {
    42 				printf ("error code is %d \n", PR_GetError());
    43 				printf ("FAIL\n");
    44 			return 1;
    45 		}
    46 	}
    47 	PR_Close(t1);
    48 	printf ("opened a file that should not exist\n");
    49 	printf ("FAIL\n");
    50 	return 1;
    51 }			

mercurial