From: Minwoo Im Date: Thu, 25 Apr 2019 13:57:44 +0000 (+0900) Subject: sanitize: Print nvme status in case ret > 0 X-Git-Tag: v1.9~76^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=525c253a6d0e71b2df1b5b3510ffc1948ff23dd1;p=users%2Fsagi%2Fnvme-cli.git sanitize: Print nvme status in case ret > 0 If given 'err' is negative, then it's an internal error so that it needs to be with perror(). If it's positive, then we can print nvme status out. Signed-off-by: Minwoo Im --- diff --git a/nvme.c b/nvme.c index b4086951..729048a6 100644 --- a/nvme.c +++ b/nvme.c @@ -2845,7 +2845,9 @@ static int sanitize(int argc, char **argv, struct command *cmd, struct plugin *p ret = nvme_sanitize(fd, cfg.sanact, cfg.ause, cfg.owpass, cfg.oipbp, cfg.no_dealloc, cfg.ovrpat); - if (ret) + if (ret < 0) + perror("sanitize"); + else if (ret > 0) show_nvme_status(ret); close_fd: