[Lost] [PATCH] ! shell: Bei einem cd Verzeichnis auch wieder schliessen, da es sonst nicht mehr geloescht werden kann
Kevin Wolf ·
Am Sonntag, 5. Oktober 2008 15:58:51 schrieb Antoine Kaufmann: > [Lost] [PATCH] ! shell: Bei einem cd Verzeichnis auch wieder schliessen, da > es sonst nicht mehr geloescht werden kann Von: > Antoine Kaufmann <toni at famkaufmann.info> > An: > "LOST-Patches" <lost at tyndur.org> > Datum: > Heute 15:58:51 > Anhänge: > beba4ab22cec6e183302a21cf20b44586fd2c4bb.diff > > --- > src/modules/c/shell/commmands.c | 1 + > src/modules/c/shell/completion.c | 1 + > 2 files changed, 2 insertions(+), 0 deletions(-) > beba4ab22cec6e183302a21cf20b44586fd2c4bb.diff > diff --git a/src/modules/c/shell/commmands.c > b/src/modules/c/shell/commmands.c index 239c181..7db5a17 100644 > --- a/src/modules/c/shell/commmands.c > +++ b/src/modules/c/shell/commmands.c > @@ -214,6 +214,7 @@ int shell_command_cd(int argc, char* argv[], const > char* args) printf("Wechseln in das Verzeichnis '%s' nicht moeglich\n", > path); } else { > chdir(path); > + closedir(dir); > } > free(path); > } Ack. Auch wenn ich nicht verstehe, warum wir da die POSIX-Funktionen benutzen müssen... > diff --git a/src/modules/c/shell/completion.c > b/src/modules/c/shell/completion.c index f452b60..7e86234 100644 > --- a/src/modules/c/shell/completion.c > +++ b/src/modules/c/shell/completion.c > @@ -251,6 +251,7 @@ static char** shell_file_matches(const char* word) > > if (list_size(matches_list) == 0) { > list_destroy(matches_list); > + directory_close(dir); > goto out; Ich würde das directory_close einfach hinter das goto out verschieben. Genauso wie das list_destroy übrigens...