~sircmpwn/ctools

983e886ff3280e65bf59f3493b7dabbc29d60e23 — Sebastian 3 years ago 14e8930 master
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 <sebastian@sebsite.pw>
1 files changed, 1 insertions(+), 1 deletions(-)

M src/rmdir.c
M src/rmdir.c => src/rmdir.c +1 -1
@@ 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;