[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 2/4] libc: errno für mkdir() setzen
! libc: Zumindest für LIOv2 bekommen wir einen Fehlercode vom Kernel
zurück, den könnten wir dann eigentlich auch nach errno schreiben.
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/modules/lib/stdlibc/directory.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/modules/lib/stdlibc/directory.c b/src/modules/lib/stdlibc/directory.c
index e8519a7..75861fd 100644
--- a/src/modules/lib/stdlibc/directory.c
+++ b/src/modules/lib/stdlibc/directory.c
@@ -33,6 +33,7 @@
#include "dir.h"
#include <string.h>
#include <lostio.h>
+#include <errno.h>
static struct dir_handle* new_opendir(const char* path)
{
@@ -173,10 +174,14 @@ static bool new_directory_create(const char* path)
char* dir = io_split_dirname(abs);
char* file = io_split_filename(abs);
bool result = false;
- lio_resource_t parent;
+ lio_resource_t parent, ret;
if ((parent = lio_resource(dir, 1)) >= 0) {
- result = (lio_mkdir(parent, file) >= 0);
+ ret = lio_mkdir(parent, file);
+ result = (ret >= 0);
+ if (!result) {
+ errno = -ret;
+ }
}
free(dir);
--
2.1.4