fs/driver: change unlink to nx_unlink to avoid setting errno

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
Juha Niskanen
2021-01-22 15:36:58 +02:00
committed by Abdelatif Guettouche
parent eaa34b458a
commit a5ff391bb3
3 changed files with 7 additions and 24 deletions
+2 -10
View File
@@ -130,16 +130,8 @@ int block_proxy(FAR struct file *filep, FAR const char *blkdev, int oflags);
* Returned Value: * Returned Value:
* If zero, non-zero inode pointer is returned on success. This * If zero, non-zero inode pointer is returned on success. This
* is the inode pointer of the nameless block driver that mediates * is the inode pointer of the nameless block driver that mediates
* accesses to the mtd driver. * accesses to the mtd driver. A negated errno value is returned on
* * any failure.
* Errors that may be returned:
*
* ENOMEM - Failed to create a temporary path name.
*
* Plus:
*
* - Errors reported from ftl_initialize()
* - Errors reported from open() or unlink()
* *
****************************************************************************/ ****************************************************************************/
+2 -3
View File
@@ -186,10 +186,9 @@ int block_proxy(FAR struct file *filep, FAR const char *blkdev, int oflags)
* a problem here!) * a problem here!)
*/ */
ret = unlink(chardev); ret = nx_unlink(chardev);
if (ret < 0) if (ret < 0)
{ {
ret = -errno;
ferr("ERROR: Failed to unlink %s: %d\n", chardev, ret); ferr("ERROR: Failed to unlink %s: %d\n", chardev, ret);
goto errout_with_chardev; goto errout_with_chardev;
} }
@@ -200,7 +199,7 @@ int block_proxy(FAR struct file *filep, FAR const char *blkdev, int oflags)
return OK; return OK;
errout_with_bchdev: errout_with_bchdev:
unlink(chardev); nx_unlink(chardev);
errout_with_chardev: errout_with_chardev:
kmm_free(chardev); kmm_free(chardev);
+3 -11
View File
@@ -131,16 +131,8 @@ static FAR char *unique_blkdev(void)
* Returned Value: * Returned Value:
* If zero, non-zero inode pointer is returned on success. This * If zero, non-zero inode pointer is returned on success. This
* is the inode pointer of the nameless block driver that mediates * is the inode pointer of the nameless block driver that mediates
* accesses to the mtd driver. * accesses to the mtd driver. A negated errno value is returned on
* * any failure.
* Errors that may be returned:
*
* ENOMEM - Failed to create a temporary path name.
*
* Plus:
*
* - Errors reported from ftl_initialize()
* - Errors reported from open() or unlink()
* *
****************************************************************************/ ****************************************************************************/
@@ -193,7 +185,7 @@ int mtd_proxy(FAR const char *mtddev, int mountflags,
*/ */
out_with_fltdev: out_with_fltdev:
unlink(blkdev); nx_unlink(blkdev);
out_with_blkdev: out_with_blkdev:
kmm_free(blkdev); kmm_free(blkdev);
return ret; return ret;