Annotation of researchv10no/cmd/odist/v10/lcreat.c, revision 1.1

1.1     ! root        1: int
        !             2: lcreat(char *name, int mode)
        !             3: {
        !             4:        char temp[14];
        !             5:        int fd;
        !             6: 
        !             7:        sprintf(temp, "lcreat.%d", getpid());   /* only works in same file system */
        !             8:        fd = creat(temp, mode);
        !             9:        if (fd < 0)
        !            10:                return fd;
        !            11:        if (link(temp, name) < 0) {
        !            12:                close(fd);
        !            13:                unlink(temp);
        !            14:                return -1;
        !            15:        }
        !            16:        unlink(temp);
        !            17:        return fd;
        !            18: }

unix.superglobalmegacorp.com

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