diff options
author | Yorhel <git@yorhel.nl> | 2009-04-26 12:58:22 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-04-26 12:58:22 +0200 |
commit | 9cc79b0fab0b4301801387abb57fc52b03f88228 (patch) | |
tree | 1f4b4f96108cccb884e2916a85fcdc958bc9185f | |
parent | 796d043c0df84fd0cb470c0bda9bacd2d39f9d14 (diff) |
Properly call calc_leavepath() on error
-rw-r--r-- | src/calc.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -169,6 +169,7 @@ int calc_dir(struct dir *dest, char *name) { t = dest; while((t = t->parent) != NULL) t->flags |= FF_SERR; + calc_leavepath(); return 0; } @@ -177,8 +178,10 @@ int calc_dir(struct dir *dest, char *name) { calc_enterpath(dr->d_name); if(calc_item(dest, dr->d_name)) dest->flags |= FF_ERR; - if(input_handle(1)) + if(input_handle(1)) { + calc_leavepath(); return 1; + } calc_leavepath(); errno = 0; } @@ -203,13 +206,16 @@ int calc_dir(struct dir *dest, char *name) { ch = 0; for(t=dest->sub; t!=NULL; t=t->next) if(t->flags & FF_DIR && !(t->flags & FF_EXL || t->flags & FF_OTHFS)) - if(calc_dir(t, t->name)) + if(calc_dir(t, t->name)) { + calc_leavepath(); return 1; + } /* chdir back */ if(chdir("..") < 0) { failed = 1; strcpy(errmsg, "Couldn't chdir to previous directory"); + calc_leavepath(); return 1; } calc_leavepath(); |