From 6034b6ee60b66b26fdc7240cc5f2f77de7549d5f Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Fri, 29 Mar 2024 20:08:36 +1300 Subject: [PATCH] fs: use unlink(2) for removing files remove(3) just calls unlink(2) when the path points to a file --- lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lfs.c b/lfs.c index 4ec63b3..59faff7 100644 --- a/lfs.c +++ b/lfs.c @@ -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); }