fs: use unlink(2) for removing files

remove(3) just calls unlink(2) when the path points to a file
This commit is contained in:
Jeremy Baxter 2024-03-29 20:08:36 +13:00
parent 6d47426ea6
commit 6034b6ee60

4
lfs.c
View file

@ -518,7 +518,7 @@ recursiveremove(lua_State *L, const char *path)
return lfail(L);
/* if it's a file... */
if (remove(path) == -1)
if (unlink(path) == -1)
return lfail(L);
lua_pushboolean(L, 1);
@ -551,7 +551,7 @@ recursiveremove(lua_State *L, const char *path)
else /* if some other error occurred */
return lfail(L);
} else {
if (remove(fullname) == -1)
if (unlink(fullname) == -1)
return lfail(L);
}