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
@ -56,7 +56,7 @@ int remove(FAR const char *path)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (unlink(path) != 0 && /* If it is indeed a directory... */
|
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))
|
rmdir(path) != 0))
|
||||||
{
|
{
|
||||||
/* Cannot remove the object for whatever reason. */
|
/* Cannot remove the object for whatever reason. */
|
||||||
|
Loading…
Reference in New Issue
Block a user