Index: zipscript/src/cleanup.c =================================================================== --- zipscript/src/cleanup.c (revision 2052) +++ zipscript/src/cleanup.c (revision 2053) @@ -196,17 +196,19 @@ if ((dir = opendir("."))) { while ((dp = readdir(dir))) - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { + if (regexec(&preg[i], dp->d_name, 1, pmatch, 0) == 0) + if (!(int)pmatch[0].rm_so && (int)pmatch[0].rm_eo == (int)NAMLEN(dp)) + if (checklink(path, dp->d_name, setfree)) + break; if ((fd = open(dp->d_name, O_NDELAY, 0777)) != -1) close(fd); - else if (setfree) { + else if (setfree) { unlink(dp->d_name); printf("Broken symbolic link \"%s\" removed.\n", dp->d_name); i=5; - } else if (regexec(&preg[i], dp->d_name, 1, pmatch, 0) == 0) - if (!(int)pmatch[0].rm_so && (int)pmatch[0].rm_eo == (int)NAMLEN(dp)) - if (checklink(path, dp->d_name, setfree)) - break; + } + } closedir(dir);