From f026f0f4bb42b1d77e2ad9f1c55e5f729a668f6d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 10 Jan 2020 12:49:36 +0100 Subject: [PATCH] rm: When invoked on a symlink, remove the symlink itself --- Userland/rm.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/rm.cpp b/Userland/rm.cpp index d8e691aa8b..2834bfb51d 100644 --- a/Userland/rm.cpp +++ b/Userland/rm.cpp @@ -12,9 +12,8 @@ int remove(bool recursive, const char* path) { struct stat path_stat; - int s = stat(path, &path_stat); - if (s < 0) { - perror("stat"); + if (lstat(path, &path_stat) < 0) { + perror("lstat"); return 1; }