diff options
-rw-r--r-- | sys/kern/kern_filedesc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index 7e65d77..f7ca2c8 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -246,6 +246,7 @@ write(int fd, const void *buf, size_t count) return -EBADF; } + mutex_acquire(&desc->lock); if (desc->oflag != O_WRONLY && desc->oflag != O_WRONLY) { ret = -EACCES; goto cleanup; @@ -271,6 +272,7 @@ write(int fd, const void *buf, size_t count) goto cleanup; } cleanup: + mutex_release(&desc->lock); dynfree(in_buf); return ret; } |