diff --git a/dka64/patches/newlib-4.1.0.patch b/dka64/patches/newlib-4.1.0.patch index db3267e..6d87b12 100644 --- a/dka64/patches/newlib-4.1.0.patch +++ b/dka64/patches/newlib-4.1.0.patch @@ -8142,10 +8142,10 @@ index 000000000..b54e0ce7c +} diff --git a/libgloss/libsysbase/rmdir.c b/libgloss/libsysbase/rmdir.c new file mode 100644 -index 000000000..2692a2997 +index 000000000..b8640b87d --- /dev/null +++ b/libgloss/libsysbase/rmdir.c -@@ -0,0 +1,25 @@ +@@ -0,0 +1,34 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -8153,24 +8153,33 @@ index 000000000..2692a2997 +#include +#include + -+int rmdir (const char *name) { -+ struct _reent *r = _REENT; ++int _rmdir_r (struct _reent *ptr, const char *name) { + int dev,ret=-1; + + dev = FindDevice(name); + if(dev!=-1) { + if(devoptab_list[dev]->rmdir_r) { -+ r->deviceData = devoptab_list[dev]->deviceData; -+ ret = devoptab_list[dev]->rmdir_r(r,name); ++ ptr->deviceData = devoptab_list[dev]->deviceData; ++ ret = devoptab_list[dev]->rmdir_r(ptr,name); + } else { -+ r->_errno = ENOSYS; ++ ptr->_errno = ENOSYS; + } + } else { -+ r->_errno = ENODEV; ++ ptr->_errno = ENODEV; + } + + return ret; +} ++ ++#ifndef _REENT_ONLY ++ ++int ++rmdir (const char *filename) ++{ ++ return _rmdir_r (_REENT, filename); ++} ++ ++#endif diff --git a/libgloss/libsysbase/sbrk.c b/libgloss/libsysbase/sbrk.c new file mode 100644 index 000000000..5dd550c5c @@ -8869,6 +8878,18 @@ index ba1a8a17e..f521cad89 100644 /* Reentrant ANSI C functions. */ #ifndef __math_68881 extern long double atanl (long double); +diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h +index 2b01fbe8f..7af875b81 100644 +--- a/newlib/libc/include/reent.h ++++ b/newlib/libc/include/reent.h +@@ -150,6 +150,7 @@ extern int _mkdir_r (struct _reent *, const char *, int); + extern int _open_r (struct _reent *, const char *, int, int); + extern _ssize_t _read_r (struct _reent *, int, void *, size_t); + extern int _rename_r (struct _reent *, const char *, const char *); ++extern int _rmdir_r (struct _reent *r, const char *name); + extern void *_sbrk_r (struct _reent *, ptrdiff_t); + extern int _stat_r (struct _reent *, const char *, struct stat *); + extern _CLOCK_T_ _times_r (struct _reent *, struct tms *); diff --git a/newlib/libc/include/semaphore.h b/newlib/libc/include/semaphore.h new file mode 100755 index 000000000..4afb0e419 @@ -10139,6 +10160,30 @@ index 84ff40b49..ba1d4ee7b 100644 #define _STDIO_WITH_THREAD_CANCELLATION_SUPPORT #endif +diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c +index d8dfdbd82..a85b5a99b 100644 +--- a/newlib/libc/stdio/remove.c ++++ b/newlib/libc/stdio/remove.c +@@ -57,13 +57,17 @@ Supporting OS subroutine required: <>. + #include <_ansi.h> + #include + #include ++#include + + int + _remove_r (struct _reent *ptr, + const char *filename) + { +- if (_unlink_r (ptr, filename) == -1) +- return -1; ++ if (_unlink_r (ptr, filename) == -1) { ++ errno = 0; ++ if (_rmdir_r(ptr, filename) == -1) ++ return -1; ++ } + + return 0; + } diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 1aaf05aa4..b67182a79 100644 --- a/newlib/libc/stdio/vfprintf.c