Commit | Line | Data |
---|---|---|
c099473f | 1 | #ifndef lint |
98dff38c | 2 | static char sccsid[] = "@(#)mkdir.c 5.2 (Berkeley) %G%"; |
c099473f RC |
3 | #endif |
4 | ||
5 | #ifndef BSD4_2 | |
6 | #include <stdio.h> | |
98dff38c | 7 | |
c099473f RC |
8 | /* |
9 | * make a directory. Also make sure that the directory is owned | |
10 | * by the right userid | |
11 | */ | |
12 | mkdir(path, mode) | |
13 | char *path; | |
14 | int mode; | |
15 | { | |
16 | int pid, status, w; | |
17 | ||
18 | if (pid=fork()) { | |
19 | while ((w = wait(&status)) != pid && w != -1) | |
20 | ; | |
21 | (void) chmod(path, mode); | |
22 | } else { | |
98dff38c | 23 | (void) umask(~mode); |
c099473f RC |
24 | (void) execlp("mkdir", "mkdir", path, (char *)NULL); |
25 | perror(path); | |
26 | _exit(1); | |
27 | } | |
98dff38c | 28 | return status; |
c099473f RC |
29 | } |
30 | #endif !BSD4_2 |