diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index c59d8a7c8..cd121c949 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1502,6 +1502,7 @@ int fcntl(int fd, int cmd, ...) | |||
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | #undef unlink | 1504 | #undef unlink |
1505 | #undef rmdir | ||
1505 | int mingw_unlink(const char *pathname) | 1506 | int mingw_unlink(const char *pathname) |
1506 | { | 1507 | { |
1507 | int ret; | 1508 | int ret; |
@@ -1512,6 +1513,7 @@ int mingw_unlink(const char *pathname) | |||
1512 | ret = unlink(pathname); | 1513 | ret = unlink(pathname); |
1513 | if (ret == -1 && errno == EACCES) { | 1514 | if (ret == -1 && errno == EACCES) { |
1514 | /* a symlink to a directory needs to be removed by calling rmdir */ | 1515 | /* a symlink to a directory needs to be removed by calling rmdir */ |
1516 | /* (the *real* Windows rmdir, not mingw_rmdir) */ | ||
1515 | if (is_symlink(pathname)) { | 1517 | if (is_symlink(pathname)) { |
1516 | return rmdir(pathname); | 1518 | return rmdir(pathname); |
1517 | } | 1519 | } |
@@ -1686,9 +1688,14 @@ int mingw_access(const char *name, int mode) | |||
1686 | return -1; | 1688 | return -1; |
1687 | } | 1689 | } |
1688 | 1690 | ||
1689 | #undef rmdir | ||
1690 | int mingw_rmdir(const char *path) | 1691 | int mingw_rmdir(const char *path) |
1691 | { | 1692 | { |
1693 | /* On Linux rmdir(2) doesn't remove symlinks */ | ||
1694 | if (is_symlink(path)) { | ||
1695 | errno = ENOTDIR; | ||
1696 | return -1; | ||
1697 | } | ||
1698 | |||
1692 | /* read-only directories cannot be removed */ | 1699 | /* read-only directories cannot be removed */ |
1693 | chmod(path, 0666); | 1700 | chmod(path, 0666); |
1694 | return rmdir(path); | 1701 | return rmdir(path); |