[tyndur-devel] [PATCH 1/4] libc: POSIX: rmdir implementieren
Kevin Wolf ·
! libc: POSIX: Ein implementiertes rmdir macht svn cleanup etwas gluecklicher Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/lib/posix/rmdir.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/lib/posix/rmdir.c b/src/modules/lib/posix/rmdir.c index 60d7f22..702c544 100644 --- a/src/modules/lib/posix/rmdir.c +++ b/src/modules/lib/posix/rmdir.c @@ -27,6 +27,8 @@ */ #include <unistd.h> +#include <dir.h> +#include <io.h> #include <errno.h> /** @@ -36,9 +38,13 @@ * * @return 0 bei Erfolg, -1 im Fehlerfall */ -int rmdir(const char* filename) { - // TODO - errno = EPERM; - return -1; +int rmdir(const char* filename) +{ + if (!is_directory(filename)) { + errno = ENOTDIR; + return -1; + } + + return io_remove_link(filename); } -- 1.5.6.5
Antworten
- [tyndur-devel] [PATCH 1/4] libc: POSIX: rmdir implementieren · Antoine Kaufmann