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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391685
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-14 09:25:54 +09:00 committed by Jim Harris
parent 3f1b35f970
commit f86f107579

View File

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