mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-03-02 09:35:28 +08:00
[dfs v2]fix fcntl(F_SETFL) bug,and modify the error code when opening… (#7878)
This commit is contained in:
parent
db24f1865a
commit
fb1faa0746
@ -502,6 +502,7 @@ int dfs_file_open(struct dfs_file *file, const char *path, int oflags, mode_t mo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_I("lookup file:%s failed in file system", path);
|
LOG_I("lookup file:%s failed in file system", path);
|
||||||
|
ret = -ENOENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,8 +908,25 @@ int dfs_file_fcntl(int fd, int cmd, unsigned long arg)
|
|||||||
ret = file->flags;
|
ret = file->flags;
|
||||||
break;
|
break;
|
||||||
case F_SETFL:
|
case F_SETFL:
|
||||||
file->flags = arg;
|
{
|
||||||
|
int flags = (int)(rt_base_t)arg;
|
||||||
|
int mask =
|
||||||
|
#ifdef O_ASYNC
|
||||||
|
O_ASYNC |
|
||||||
|
#endif
|
||||||
|
#ifdef O_DIRECT
|
||||||
|
O_DIRECT |
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOATIME
|
||||||
|
O_NOATIME |
|
||||||
|
#endif
|
||||||
|
O_APPEND | O_NONBLOCK;
|
||||||
|
|
||||||
|
flags &= mask;
|
||||||
|
file->flags &= ~mask;
|
||||||
|
file->flags |= flags;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case F_GETLK:
|
case F_GETLK:
|
||||||
break;
|
break;
|
||||||
case F_SETLK:
|
case F_SETLK:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user