Commit f86f1075 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

conf: Remove use of perror() for strdup() failure



All SPDK libraries should use the spdk/log.h family of functions
for logging.

The cause of strdup failure is only out-of-memory for malloc().
Hence errno is omitted.

Change-Id: I682f11fbb6f12c9de8d57a025b704b4f050f7474
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391685


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 3f1b35f9
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ parse_line(struct spdk_conf *cp, char *lp)
		cp->current_section = sp;
		sp->name = strdup(key);
		if (sp->name == NULL) {
			perror("strdup sp->name");
			SPDK_ERRLOG("cannot duplicate %s to sp->name\n", key);
			return -1;
		}

@@ -513,7 +513,7 @@ parse_line(struct spdk_conf *cp, char *lp)
		append_cf_item(sp, ip);
		ip->key = strdup(key);
		if (ip->key == NULL) {
			perror("strdup ip->key");
			SPDK_ERRLOG("cannot make duplicate of %s\n", key);
			return -1;
		}
		ip->val = NULL;
@@ -529,7 +529,7 @@ parse_line(struct spdk_conf *cp, char *lp)
				append_cf_value(ip, vp);
				vp->value = strdup(val);
				if (vp->value == NULL) {
					perror("strdup vp->value");
					SPDK_ERRLOG("cannot duplicate %s to vp->value\n", val);
					return -1;
				}
			}
@@ -617,7 +617,7 @@ spdk_conf_read(struct spdk_conf *cp, const char *file)

	cp->file = strdup(file);
	if (cp->file == NULL) {
		perror("strdup cp->file");
		SPDK_ERRLOG("cannot duplicate %s to cp->file\n", file);
		fclose(fp);
		return -1;
	}