|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 04/14] qga: Use error_setg_file_open() for better error messages
Error messages change from
open("FNAME"): REASON
to
Could not open 'FNAME': REASON
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
qga/commands-linux.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/qga/commands-linux.c b/qga/commands-linux.c
index 4a09ddc760..5cf76ca2d9 100644
--- a/qga/commands-linux.c
+++ b/qga/commands-linux.c
@@ -1502,14 +1502,15 @@ static void transfer_vcpu(GuestLogicalProcessor *vcpu,
bool sys2vcpu,
dirfd = open(dirpath, O_RDONLY | O_DIRECTORY);
if (dirfd == -1) {
- error_setg_errno(errp, errno, "open(\"%s\")", dirpath);
+ error_setg_file_open(errp, errno, dirpath);
return;
}
fd = openat(dirfd, fn, sys2vcpu ? O_RDONLY : O_RDWR);
if (fd == -1) {
if (errno != ENOENT) {
- error_setg_errno(errp, errno, "open(\"%s/%s\")", dirpath, fn);
+ error_setg_errno(errp, errno, "could not open %s/%s",
+ dirpath, fn);
} else if (sys2vcpu) {
vcpu->online = true;
vcpu->can_offline = false;
@@ -1711,7 +1712,7 @@ static void transfer_memory_block(GuestMemoryBlock
*mem_blk, bool sys2memblk,
dirfd = open(dirpath, O_RDONLY | O_DIRECTORY);
if (dirfd == -1) {
if (sys2memblk) {
- error_setg_errno(errp, errno, "open(\"%s\")", dirpath);
+ error_setg_file_open(errp, errno, dirpath);
} else {
if (errno == ENOENT) {
result->response = GUEST_MEMORY_BLOCK_RESPONSE_TYPE_NOT_FOUND;
@@ -1936,7 +1937,7 @@ static GuestDiskStatsInfoList *guest_get_diskstats(Error
**errp)
fp = fopen(diskstats, "r");
if (fp == NULL) {
- error_setg_errno(errp, errno, "open(\"%s\")", diskstats);
+ error_setg_file_open(errp, errno, diskstats);
return NULL;
}
@@ -2047,7 +2048,7 @@ GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp)
fp = fopen(cpustats, "r");
if (fp == NULL) {
- error_setg_errno(errp, errno, "open(\"%s\")", cpustats);
+ error_setg_file_open(errp, errno, cpustats);
return NULL;
}
--
2.49.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |