X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funlink.c;h=677d58493d10c954f543a36d8bb367a211b10642;hb=b41ff9f532d1755fd1267e6ea4f9d744dc95ec67;hp=3e42e28692c373861649eaea61675fc773bf0235;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/lib/unlink.c b/lib/unlink.c index 3e42e2869..677d58493 100644 --- a/lib/unlink.c +++ b/lib/unlink.c @@ -1,6 +1,6 @@ /* Work around unlink bugs. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 @@ -24,6 +24,8 @@ #include #include +#include "dosname.h" + #undef unlink /* Remove file NAME. @@ -80,6 +82,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; }