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:
chenrun1 2024-07-11 16:44:17 +08:00 committed by Xiang Xiao
parent e6962942cb
commit 0a4770b44a

View file

@ -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. */