Annotation of 43BSDReno/sys/nfs/TEST/unix-tests/special/excltest.c, revision 1.1

1.1     ! root        1: /*     @(#)excltest.c  1.2 90/01/03 NFS Rev 2 Testsuite
        !             2:  *     1.3 Lachman ONC Test Suite source
        !             3:  *
        !             4:  * test exclusive create
        !             5:  */
        !             6: #include <stdio.h>
        !             7: #ifdef SVR3
        !             8: #include <fcntl.h>
        !             9: #else
        !            10: #include <sys/file.h>
        !            11: #endif
        !            12: 
        !            13: main(argc, argv)
        !            14:        int argc;
        !            15:        char *argv[];
        !            16: {
        !            17:        int fd;
        !            18: 
        !            19:        if (argc > 2) {
        !            20:                fprintf(stderr, "usage: %s [count]\n", argv[0]);
        !            21:                exit(1);
        !            22:        }
        !            23:        if (argc == 2) {
        !            24:                int count = atoi(argv[1]);
        !            25:                for (; count; count--) {
        !            26:                        open("exctest.file", O_CREAT | O_EXCL, 0777);
        !            27:                }
        !            28:                exit(0);
        !            29:        }
        !            30:        unlink("exctest.file");
        !            31:        if (open("exctest.file", O_CREAT | O_EXCL, 0777) < 0) {
        !            32:                perror("exctest.file");
        !            33:                exit(1);
        !            34:        }
        !            35:        if (open("exctest.file", O_CREAT | O_EXCL, 0777) < 0) {
        !            36:                perror("exctest.file2");
        !            37:                exit(0);
        !            38:        }
        !            39:        exit(0);
        !            40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.