Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E320836A02B for ; Thu, 20 Nov 2025 19:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763666040; cv=none; b=s90EPSwSwxMpl8xgrbMSstlm1hX2wyZBqCxZp36Dcla4S4LrsYUnmMTLzXkhwhEFGGWBX9Fuv8EA3WQG0SLOJsmn+POehi9rhYCeXNdnjIX5tODXoL7EAiyuImYA8L1FAWhARejrG0pyZt7GTtOBb7wxNz260csfWWXze/wkdMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763666040; c=relaxed/simple; bh=l15bQKcGnIad+7Uo7xetK0Kko5tXY2PCiJoyy5Bi6yE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a6U0cF6PSQbpv0cO9VxvBB0W9RS9L5/iDD4V8Ut5+NPQ4p/LQlMcRznGk/vj/9QgPjvqyjje1oHLNY+FuiRTdLPIm0hzy/pDaaTYbn3oxg7HUOyCcP+n9tord/BmW2DVOjoxQripaEZutosGLlXXGEWxEBnmG/kshzNuKooM+Aw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Hy28F5l1; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hy28F5l1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763666038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tDP8FM9QFpX4om5r6DeJVNNuFVvQYDlKs2mHtRlqAfQ=; b=Hy28F5l1OuVC0u4ZDGaKNH8alzeQ2b++CExna9o7id3NBBqsW4Cezp3tTldcbNhSVrW9Hl +6wpjiJfyEY/NPGsN7tMrg0AOU1Llme9ivFinVTUhxyoVPlyrDhpEYDujSjZhqswYErJr5 ICOsjdhM8ksRs3WL0Quo3obH3l5uDWk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-b5T3lBd2OV2uCxy3edrDZw-1; Thu, 20 Nov 2025 14:13:55 -0500 X-MC-Unique: b5T3lBd2OV2uCxy3edrDZw-1 X-Mimecast-MFC-AGG-ID: b5T3lBd2OV2uCxy3edrDZw_1763666026 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 66F73195422D; Thu, 20 Nov 2025 19:13:46 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.18]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D535A1800984; Thu, 20 Nov 2025 19:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 87A9C21EC344; Thu, 20 Nov 2025 20:13:39 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: arei.gonglei@huawei.com, pizhenwei@bytedance.com, alistair.francis@wdc.com, stefanb@linux.vnet.ibm.com, kwolf@redhat.com, hreitz@redhat.com, sw@weilnetz.de, qemu_oss@crudebyte.com, groug@kaod.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, kraxel@redhat.com, shentey@gmail.com, npiggin@gmail.com, harshpb@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, edgar.iglesias@gmail.com, elena.ufimtseva@oracle.com, jag.raman@oracle.com, sgarzare@redhat.com, pbonzini@redhat.com, fam@euphon.net, philmd@linaro.org, alex@shazbot.org, clg@redhat.com, peterx@redhat.com, farosas@suse.de, lizhijian@fujitsu.com, dave@treblig.org, jasowang@redhat.com, samuel.thibault@ens-lyon.org, michael.roth@amd.com, kkostiuk@redhat.com, zhao1.liu@intel.com, mtosatti@redhat.com, rathc@linux.ibm.com, palmer@dabbelt.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, marcandre.lureau@redhat.com, qemu-block@nongnu.org, qemu-ppc@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, qemu-riscv@nongnu.org Subject: [PATCH 13/14] qga/commands-win32: Use error_setg_win32() for better error messages Date: Thu, 20 Nov 2025 20:13:38 +0100 Message-ID: <20251120191339.756429-14-armbru@redhat.com> In-Reply-To: <20251120191339.756429-1-armbru@redhat.com> References: <20251120191339.756429-1-armbru@redhat.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 We include numeric GetLastError() codes in error messages in a few places, like this: error_setg(errp, "GRIPE: %d", (int)GetLastError()); Show text instead, like this: error_setg_win32(errp, GetLastError(), "GRIPE"); Signed-off-by: Markus Armbruster --- qga/commands-win32.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index acc2c11589..0fd0c966e4 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -1798,8 +1798,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) tf.dwHighDateTime = (DWORD) (time >> 32); if (!FileTimeToSystemTime(&tf, &ts)) { - error_setg(errp, "Failed to convert system time %d", - (int)GetLastError()); + error_setg_win32(errp, GetLastError(), + "Failed to convert system time"); return; } @@ -1810,7 +1810,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) } if (!SetSystemTime(&ts)) { - error_setg(errp, "Failed to set time to guest: %d", (int)GetLastError()); + error_setg_win32(errp, GetLastError(), + "Failed to set time to guest"); return; } } @@ -1834,13 +1835,12 @@ GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp) (length > sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) { ptr = pslpi = g_malloc0(length); if (GetLogicalProcessorInformation(pslpi, &length) == FALSE) { - error_setg(&local_err, "Failed to get processor information: %d", - (int)GetLastError()); + error_setg_win32(&local_err, GetLastError(), + "Failed to get processor information"); } } else { - error_setg(&local_err, - "Failed to get processor information buffer length: %d", - (int)GetLastError()); + error_setg_win32(&local_err, GetLastError(), + "Failed to get processor information buffer length"); } while ((local_err == NULL) && (length > 0)) { -- 2.49.0