From 115e3ce205b718e6ebc06f0ab8b9ae5d55cb92d0 Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Wed, 3 Apr 2019 23:53:33 +0900 Subject: [PATCH] fabrics: Return negative errno when asprintf() fails asprintf() will return -1 when it fails to allocate memory for the string given with setting errno to ENOMEM. For the uniformity, we can return errno with negative value. Signed-off-by: Minwoo Im --- fabrics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabrics.c b/fabrics.c index f5cd212..96f740b 100644 --- a/fabrics.c +++ b/fabrics.c @@ -852,7 +852,7 @@ static int do_discover(char *argstr, bool connect) return instance; if (asprintf(&dev_name, "/dev/nvme%d", instance) < 0) - return errno; + return -errno; ret = nvmf_get_log_page_discovery(dev_name, &log, &numrec); free(dev_name); remove_ctrl(instance); -- 2.50.1