Fixed recursion in cp

This commit is contained in:
Your Name 2023-10-17 20:27:56 +03:00
parent 90d49dd3cf
commit 71b98e52d8

View File

@ -99,7 +99,7 @@ int cptree(const char *src, const char *dst) {
struct dirent *ep;
while ((ep = readdir(dir)) != NULL) {
if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, ".."))
if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, "..") || !strcmp(dst, ep->d_name))
continue;
char *src_path = make_path(src, ep->d_name);