Skip to contentSkip to conversation

tools/libxc: Identify problematic file in error messages

PATCH In review Andrew Cooper 2 participants 2 messages Dec 7, 2015 – Dec 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc: Identify problematic file in error messages

Error messages along the lines of:

xc: error: panic: xc_dom_core.c:207: failed to open file: No such file or
directory: Internal error

are of very little use.

Include the filename in the error messages, so the user does not have to resort to debug level logging to identify the problem.

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/libxc/xc_dom_core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tools/libxc/xc_dom_core.c +6 -6
index 841e7dc..2061ba6 100644
@@ -203,16 +203,16 @@ void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
     fd = open(filename, O_RDONLY);
     if ( fd == -1 ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to open file: %s",
-                     strerror(errno));
+                     "failed to open file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
     if ( (lseek(fd, 0, SEEK_SET) == -1) ||
          ((offset = lseek(fd, 0, SEEK_END)) == -1) ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to seek on file: %s",
-                     strerror(errno));
+                     "failed to seek on file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
@@ -239,8 +239,8 @@ void *xc_dom_malloc_filemap(struct xc_dom_image *dom,
                            MAP_SHARED, fd, 0);
     if ( block->ptr == MAP_FAILED ) {
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
-                     "failed to mmap file: %s",
-                     strerror(errno));
+                     "failed to mmap file '%s': %s",
+                     filename, strerror(errno));
         goto err;
     }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 6 lines · Andrew Cooper

Error messages along the lines of:

   xc: error: panic: xc_dom_core.c:207: failed to open file: No such file or
   directory: Internal error

Quoted 6 lines

are of very little use.

Include the filename in the error messages, so the user does not have to resort to debug level logging to identify the problem.

Acked + applied.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel