fangxinyong 5176fb917a fs/vfs: ftruncate produce EINVAL if fd is not open for writing
As posix spec, ftruncate should produce EBADF or EINVAL error,
if the file descriptor fd is not open for writing.

Change the behavior to be similar to Linux and pass ltp open_posix test:
testcases/open_posix_testsuite/conformance/interfaces/shm_open/20-1.c

https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html
https://man7.org/linux/man-pages/man2/ftruncate.2.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
..
2023-08-01 23:15:37 +02:00
2023-08-01 23:15:37 +02:00
2023-07-31 21:41:30 -07:00
2023-07-11 23:32:17 +08:00
2023-07-29 20:27:10 -07:00
2023-08-01 23:15:37 +02:00
2023-08-01 23:15:37 +02:00
2023-07-11 23:32:17 +08:00
2023-01-28 19:53:20 +02:00