Changeset 440 for trunk/kernel/syscalls/sys_getcwd.c
- Timestamp:
- May 3, 2018, 5:51:22 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_getcwd.c
r124 r440 2 2 * sys_getcwd.c - get process current work directory 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 40 40 { 41 41 error_t error; 42 paddr_t paddr;42 vseg_t * vseg; 43 43 char kbuf[CONFIG_VFS_MAX_PATH_LENGTH]; 44 44 … … 49 49 if( nbytes < CONFIG_VFS_MAX_PATH_LENGTH ) 50 50 { 51 printk("\n[ERROR] in %s : buffer too small\n", __FUNCTION__ ); 52 this->errno = ERANGE; 51 52 #if DEBUG_SYSCALLS_ERROR 53 printk("\n[ERROR] in %s : buffer too small / thread %x / process %x\n", 54 __FUNCTION__ , this->trdid , process->pid ); 55 #endif 56 this->errno = EINVAL; 53 57 return -1; 54 58 } 55 59 56 60 // check buffer in user space 57 error = vmm_ v2p_translate( false , buf , &paddr);61 error = vmm_get_vseg( process, (intptr_t)buf , &vseg ); 58 62 59 63 if( error ) 60 64 { 61 printk("\n[ERROR] in %s : user buffer unmapped\n", __FUNCTION__ ); 62 this->errno = EFAULT; 65 66 #if DEBUG_SYSCALLS_ERROR 67 printk("\n[ERROR] in %s : user buffer unmapped %x / thread %x / process %x\n", 68 __FUNCTION__ , (intptr_t)buf , this->trdid , process->pid ); 69 #endif 70 this->errno = EINVAL; 63 71 return -1; 64 72 }
Note: See TracChangeset
for help on using the changeset viewer.