Be less noisy when handling wedge name conflicts.

This commit is contained in:
mlelstv 2014-11-04 07:43:00 +00:00
parent 8afe144b7b
commit 6f5687b0bb

View File

@ -1,4 +1,4 @@
/* $NetBSD: dkwedge_gpt.c,v 1.13 2014/10/18 08:33:27 snj Exp $ */ /* $NetBSD: dkwedge_gpt.c,v 1.14 2014/11/04 07:43:00 mlelstv Exp $ */
/*- /*-
* Copyright (c) 2004 The NetBSD Foundation, Inc. * Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.13 2014/10/18 08:33:27 snj Exp $"); __KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.14 2014/11/04 07:43:00 mlelstv Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -265,13 +265,15 @@ dkwedge_discover_gpt(struct disk *pdk, struct vnode *vp)
* Try with the partition name first. If that fails, * Try with the partition name first. If that fails,
* use the GUID string. If that fails, punt. * use the GUID string. If that fails, punt.
*/ */
if ((error = dkwedge_add(&dkw)) == EEXIST) { if ((error = dkwedge_add(&dkw)) == EEXIST &&
aprint_error("%s: wedge named '%s' already exists, " strcmp(dkw.dkw_wname, ent_guid_str) != 0) {
"trying '%s'\n", pdk->dk_name,
dkw.dkw_wname, /* XXX Unicode */
ent_guid_str);
strcpy(dkw.dkw_wname, ent_guid_str); strcpy(dkw.dkw_wname, ent_guid_str);
error = dkwedge_add(&dkw); error = dkwedge_add(&dkw);
if (!error)
aprint_error("%s: wedge named '%s' already "
"existed, using '%s'\n", pdk->dk_name,
dkw.dkw_wname, /* XXX Unicode */
ent_guid_str);
} }
if (error == EEXIST) if (error == EEXIST)
aprint_error("%s: wedge named '%s' already exists, " aprint_error("%s: wedge named '%s' already exists, "