]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
tools/libxc: Identify problematic file in error messages
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 Dec 2015 13:09:08 +0000 (13:09 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 8 Dec 2015 16:53:49 +0000 (16:53 +0000)
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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_dom_core.c

index 841e7dc355a2eaebb948a804f6288cdaee2504ea..2061ba692154b4ded0f6ab7d0c70cdb07e185737 100644 (file)
@@ -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;
     }