mirror of
https://github.com/apache/nuttx.git
synced 2026-09-13 22:20:24 +00:00
lib_remove:Repair the logical judgment
Summary:
When the deleted path is a file, the return value of get_errno is -EISDIR, so in Condition Two
(get_errno() ! = EPERM && /* .... . try to remove it. */
rmdir(path) ! = 0)
The judgment holds directly, so it can't actually execute to rmdir
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
e6962942cb
commit
0a4770b44a
1 changed files with 1 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ int remove(FAR const char *path)
|
|||
*/
|
||||
|
||||
if (unlink(path) != 0 && /* If it is indeed a directory... */
|
||||
(get_errno() != EPERM || /* ...try to remove it. */
|
||||
(get_errno() != EISDIR || /* ...try to remove it. */
|
||||
rmdir(path) != 0))
|
||||
{
|
||||
/* Cannot remove the object for whatever reason. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue