Bug fixes master
authorRobert Pengelly <robertapengelly@hotmail.com>
Sat, 5 Apr 2025 20:39:51 +0000 (21:39 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sat, 5 Apr 2025 20:39:51 +0000 (21:39 +0100)
lib.c
rm.c

diff --git a/lib.c b/lib.c
index 6a276f6e50defd285bdb9557085940acf1cd98aa..54c239eff70aaa839ad0dad40c56de677e78071e 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -72,12 +72,13 @@ void parse_args (int argc, char **argv, int optind) {
     
     }
     
-    r = argv[optind++];
+    r = argv[optind];
     
 check_options:
     
-    if (r[0] == '-') {
+    if (*r == '-') {
     
+        optind++;
         r++;
         
         while (*r != '\0') {
diff --git a/rm.c b/rm.c
index c568f5cf036089b0b7f04ea5e6ea46ca9b3042a2..13e22c062ef38ab24ee0e20572fa2fafb66ab29f 100644 (file)
--- a/rm.c
+++ b/rm.c
@@ -115,7 +115,7 @@ static void rm (const char *path) {
     
     } else {
     
-        if (!state->fflag && remove (p2)) {
+        if (remove (p2) && !state->fflag) {
             report_at (program_name, 0, REPORT_ERROR, "unable to remove %s", p2);
         }