diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-08-13 14:32:21 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-08-13 16:52:15 +0200 |
commit | b184805fccfabba85ba66120062a9dca27fd6589 (patch) | |
tree | d6f6334fdec0a3ed1e75e32ad648e3acf4144a22 /commands/flash.c | |
parent | 75a9c260c88afa87ba13b28df8168cfba7f1ce15 (diff) | |
download | barebox-b184805fccfabba85ba66120062a9dca27fd6589.tar.gz barebox-b184805fccfabba85ba66120062a9dca27fd6589.tar.xz |
add missing close() in do_protect
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/flash.c')
-rw-r--r-- | commands/flash.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/commands/flash.c b/commands/flash.c index 5876fc7d55..ac81b31c79 100644 --- a/commands/flash.c +++ b/commands/flash.c @@ -117,6 +117,7 @@ static int do_protect (cmd_tbl_t *cmdtp, int argc, char *argv[]) struct stat s; int prot = 1; unsigned long start = 0, size = ~0; + int ret = 0; if (argc == 1) { u_boot_cmd_usage(cmdtp); @@ -149,17 +150,19 @@ static int do_protect (cmd_tbl_t *cmdtp, int argc, char *argv[]) if (argc == 3) if (parse_area_spec(argv[2], &start, &size)) { printf("could not parse: %s\n", argv[optind]); - return 1; + ret = 1; + goto out; } if(protect(fd, size, start, prot)) { perror("protect"); - return 1; + ret = 1; + goto out; } - +out: close(fd); - return 0; + return ret; } static const __maybe_unused char cmd_protect_help[] = |