* @brief Rename or move a file or directory. * * This function renames or moves a file or directory from `oldpath` to `newpath`. * If the `newpath` exists, it may be overwritten depending on the system's file system behavior and * the permissions of the files involved. * * @param[in] oldpath The current path of the file or directory to rename or move. * @param[in] newpath The new path or
| 8263 | * @see sys_unlink(), sys_mkdir(), sys_access() |
| 8264 | */ |
| 8265 | sysret_t sys_rename(const char *oldpath, const char *newpath) |
| 8266 | { |
| 8267 | int ret = -1; |
| 8268 | #ifdef ARCH_MM_MMU |
| 8269 | int err; |
| 8270 | |
| 8271 | err = lwp_user_strlen(oldpath); |
| 8272 | if (err <= 0) |
| 8273 | { |
| 8274 | return -EFAULT; |
| 8275 | } |
| 8276 | |
| 8277 | err = lwp_user_strlen(newpath); |
| 8278 | if (err <= 0) |
| 8279 | { |
| 8280 | return -EFAULT; |
| 8281 | } |
| 8282 | #endif |
| 8283 | ret = rename(oldpath, newpath); |
| 8284 | return (ret < 0 ? GET_ERRNO() : ret); |
| 8285 | } |
| 8286 | |
| 8287 | typedef unsigned long long rlim_t; |
| 8288 |
nothing calls this directly
no test coverage detected