X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funlink.c;h=8d53b11db6a44e489230fb79baa0de3e211b3447;hb=4f73e86209f313dfc2b9dd649fa6bcdf8122310f;hp=5585158887384c8488a02d69247963c1cde549cc;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/lib/unlink.c b/lib/unlink.c index 558515888..8d53b11db 100644 --- a/lib/unlink.c +++ b/lib/unlink.c @@ -1,6 +1,6 @@ /* Work around unlink bugs. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,6 +80,16 @@ rpl_unlink (char const *name) } } if (!result) - result = unlink (name); + { +#if UNLINK_PARENT_BUG + if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.' + && (len == 2 || ISSLASH (name[len - 3]))) + { + errno = EISDIR; /* could also use EPERM */ + return -1; + } +#endif + result = unlink (name); + } return result; }