summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/rm.c b/rm.c
index e54793d..6d92815 100644
--- a/rm.c
+++ b/rm.c
@@ -64,6 +64,7 @@ static int rm_prompt(const char *p)
if (!compiled) {
char *yesexpr = nl_langinfo(YESEXPR);
regcomp(&yesre, yesexpr, REG_EXTENDED | REG_ICASE | REG_NOSUB);
+ compiled = 1;
}
if (regexec(&yesre, buf, 0, NULL, 0) == 0) {
@@ -80,10 +81,8 @@ int rm(const char *p, const struct stat *st, int typeflag, struct FTW *f)
if (st == NULL) {
fprintf(stderr, "rm: %s: unknown error\n", p);
retval = 1;
- return 0;
- }
- if (S_ISDIR(st->st_mode)) {
+ } else if (S_ISDIR(st->st_mode)) {
if (!recursive) {
fprintf(stderr, "rm: %s: %s\n", p, strerror(EISDIR));
retval = 1;