1 /*
2  * The contents of this file are subject to the terms of the
3  * Common Development and Distribution License, Version 1.0 only
4  * (the "License").  You may not use this file except in compliance
5  * with the License.
6  *
7  * See the file CDDL.Schily.txt in this distribution for details.
8  *
9  * When distributing Covered Code, include this CDDL HEADER in each
10  * file and include the License file CDDL.Schily.txt from this distribution.
11  */
12 /*
13  *	Mkdirs (mkdir -p) + check for errno != EEXIST
14  *
15  *	path must be modifyable as we insert null bytes when traversing the tree.
16  *
17  * @(#)xmkdirs.c	1.1 15/02/28 Copyright 2015 J. Schilling
18  */
19 #if defined(sun)
20 #pragma ident "@(#)xmkdirs.c	1.1 15/02/28 Copyright 2015 J. Schilling"
21 #endif
22 
23 #if defined(sun)
24 #pragma ident	"@(#)xmkdirs.c"
25 #pragma ident	"@(#)sccs:lib/mpwlib/xmkdirs.c"
26 #endif
27 #include	<defines.h>
28 
29 EXPORT int
30 #ifdef  PROTOTYPES
xmkdirs(char * path,mode_t mode)31 xmkdirs(char *path, mode_t mode)
32 #else
33 xmkdirs(path, mode)
34 	char	*path;
35 	mode_t	mode;
36 #endif
37 {
38 	int	ret;
39 
40 	if ((ret = mkdirs(path, mode)) < 0) {
41 		if (errno != EEXIST) {
42 			Ffile = path;
43 			efatal(gettext("cannot make directories (ut15)"));
44 		}
45 	}
46 	return (ret);
47 }
48