1 /* On some systems, mkdir ("foo/", 0700) fails because of the trailing
2 slash. On those systems, this wrapper removes the trailing slash.
4 Copyright (C) 2001, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 /* written by Jim Meyering */
26 /* Disable the definition of mkdir to rpl_mkdir (from config.h) in this
27 file. Otherwise, we'd get conflicting prototypes for rpl_mkdir on
31 #include <sys/types.h>
40 /* This function is required at least for NetBSD 1.5.2. */
43 rpl_mkdir (char const *dir
, mode_t mode
)
47 size_t len
= strlen (dir
);
49 if (len
&& dir
[len
- 1] == '/')
51 tmp_dir
= xstrdup (dir
);
52 strip_trailing_slashes (tmp_dir
);
56 tmp_dir
= (char *) dir
;
59 ret_val
= mkdir (tmp_dir
, mode
);