diff --git a/sys/fs/fat/fat.c b/sys/fs/fat/fat.c index 54db354..760641c 100644 --- a/sys/fs/fat/fat.c +++ b/sys/fs/fat/fat.c @@ -147,8 +147,10 @@ else if ((fd->mode & 0x2) == 0x2) { if ((fd->mode & 0x8) == 0x8) _file = fl_fopen(file, "a"); - else + else { _file = fl_fopen(file, "w"); + kprintf("open for writing"); + } } else kprintf("Invalid Mode?"); diff --git a/sys/include/sys/types.h b/sys/include/sys/types.h index 70d5723..4360020 100644 --- a/sys/include/sys/types.h +++ b/sys/include/sys/types.h @@ -33,10 +33,10 @@ #include #ifndef NULL -#define NULL 0x0 +#define NULL ( (void *) 0) #endif -typedef __uintfptr_t uintfptr_t; +typedef __uintfptr_t uintfptr_t; typedef char *caddr_t; @@ -115,7 +115,7 @@ #endif typedef __ssize_t ssize_t; -typedef char * caddr_t; +typedef char *caddr_t; typedef __int64_t off_t; typedef __uint32_t vm_offset_t; @@ -171,9 +171,8 @@ /* Combine two `digits' to make a single two-digit number. */ #define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) - #ifndef _MODE_T_DECLARED -typedef __mode_t mode_t; /* permissions */ +typedef __mode_t mode_t; /* permissions */ #define _MODE_T_DECLARED #endif diff --git a/sys/kernel/descrip.c b/sys/kernel/descrip.c index 4b8892f..c7b41e6 100644 --- a/sys/kernel/descrip.c +++ b/sys/kernel/descrip.c @@ -346,6 +346,7 @@ } int dup2(struct thread *td, u_int32_t from, u_int32_t to) { + struct file *fp = 0x0; struct file *dup_fp = 0x0; @@ -365,13 +366,10 @@ memcpy(dup_fp, fp, sizeof(struct file)); - kprintf("DUP2.0: %i:%i [0x%X:0x%X]", from, to, td->o_files[from], td->o_files[to]); - td->o_files[to] = (void*) dup_fp; ((struct file*) td->o_files[from])->fd->dup++; - kprintf("DUP2.1: %i:%i <%i> [0x%X:0x%X]", from, to, ((struct file*) td->o_files[from])->fd->dup, td->o_files[from], td->o_files[to]); return (0x0); }