From 983e886ff3280e65bf59f3493b7dabbc29d60e23 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 3 Oct 2021 19:50:34 -0400 Subject: [PATCH] Fix non-portable use of dirname(3) in rmdir Fixes ticket #6: https://todo.sr.ht/~sircmpwn/ctools/6 The implementation of rmdir was dependent on dirname(3) modifying its source, which isn't portable behavior. This commit ensures that path is always modified. Signed-off-by: Sebastian --- src/rmdir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rmdir.c b/src/rmdir.c index c06c3cc..6395d9f 100644 --- a/src/rmdir.c +++ b/src/rmdir.c @@ -38,7 +38,7 @@ main(int argc, char *argv[]) perror("rmdir"); return 1; } - } while (remove_path && strcmp(dirname(path), ".") != 0); + } while (remove_path && strcmp((path = dirname(path)), ".") != 0); } return 0; -- 2.38.5