From aa82932e71906cbec11b708eba3979688f1d0ad9 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Thu, 30 Nov 2017 16:31:28 +1100 Subject: gard: Fix up do_create return values The return value of a subcommand is interpreted as a libflash error code when it's positive or some subcommand specific error when negative. Currently the create subcommand always returns zero when exiting (even for errors) so fix that. Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- external/gard/gard.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'external') diff --git a/external/gard/gard.c b/external/gard/gard.c index f73b2dc..86fcbe8 100644 --- a/external/gard/gard.c +++ b/external/gard/gard.c @@ -668,12 +668,12 @@ static int do_create(struct gard_ctx *ctx, int argc, char **argv) fprintf(stderr, "e.g.\n"); fprintf(stderr, " /Sys0/Node0/Proc0\n"); fprintf(stderr, " /Sys0/Node0/DIMM15\n"); - return 0; + return -1; } if (parse_path(argv[1], &path)) { fprintf(stderr, "Unable to parse path\n"); - return 0; + return -1; } /* check if we already have a gard record applied to this path */ @@ -682,7 +682,7 @@ static int do_create(struct gard_ctx *ctx, int argc, char **argv) fprintf(stderr, "Unit %s is already GARDed by record %#08x\n", argv[1], be32toh(gard.record_id)); - return 0; + return -1; } /* @@ -709,7 +709,7 @@ static int do_create(struct gard_ctx *ctx, int argc, char **argv) if (offset > ctx->gard_data_len - sizeof(gard)) { fprintf(stderr, "No space in GUARD for a new record\n"); - return 0; + return -1; } rc = blocklevel_smart_write(ctx->bl, -- cgit v1.1