]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
sanitize: Print nvme status in case ret > 0
authorMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 25 Apr 2019 13:57:44 +0000 (22:57 +0900)
committerMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 25 Apr 2019 13:57:44 +0000 (22:57 +0900)
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 <minwoo.im.dev@gmail.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index b40869519c60f28ac8862b0dc0e2204291d2be96..729048a66f395457ff5e0a65605a0e46d9bd2457 100644 (file)
--- 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: