diff options
author | Andreas Kling <awesomekling@gmail.com> | 2020-01-10 12:49:36 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-10 14:02:52 +0100 |
commit | f026f0f4bb42b1d77e2ad9f1c55e5f729a668f6d (patch) | |
tree | c7ecc473f2666224cb2d6acedc1431099b85f9b6 /Userland/rm.cpp | |
parent | 8f20b173fd40d7f4c7d593e3070187a482b5352e (diff) | |
download | serenity-f026f0f4bb42b1d77e2ad9f1c55e5f729a668f6d.zip |
rm: When invoked on a symlink, remove the symlink itself
Diffstat (limited to 'Userland/rm.cpp')
-rw-r--r-- | Userland/rm.cpp | 5 |
1 files 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; } |