1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Work around rmdir bugs.
5 Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2011 Free Software
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
32 /* Remove directory DIR.
33 Return 0 if successful, -1 if not. */
36 rpl_rmdir (char const *dir
)
38 /* Work around cygwin 1.5.x bug where rmdir("dir/./") succeeds. */
39 size_t len
= strlen (dir
);
41 while (len
&& ISSLASH (dir
[len
- 1]))
43 if (len
&& dir
[len
- 1] == '.' && (1 == len
|| ISSLASH (dir
[len
- 2])))
49 /* Work around mingw bug, where rmdir("file/") fails with EINVAL
50 instead of ENOTDIR. We've already filtered out trailing ., the
51 only reason allowed by POSIX for EINVAL. */
52 if (result
== -1 && errno
== EINVAL
)