Skip to contentSkip to conversation

fix libxc not to hide real errno with EBADF

PATCH In review Steven Rostedt 2 participants 4 messages Aug 4, 2006 – Aug 5, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix libxc not to hide real errno with EBADF

I'm currently looking for a cause of a bug that's giving me an invalid argument on an ioctl call with libxc. But before I found where the problem was I was constantly getting a Bad File Descriptor error. Well that is because the clean up of gzclose is done after the file descriptor that gzdopen used is closed when it doesn't need to be. This patch allows for proper clean up and the correct errno to be presented.

-- Steve

(this may have white space damage, so I'm attaching the same patch as well. Haven't yet figured out how to do proper inline patches in thunderbird)

tools/libxc/xc_linux_build.c +3 -3
diff -r 9632ececc8f4 tools/libxc/xc_linux_build.c
@@ -1373,10 +1373,10 @@ int xc_linux_build(int xc_handle,
 
 error_out:
    free(image);
-    if ( fd >= 0 )
+    if ( initrd_info.type == INITRD_file && initrd_info.u.file_handle )
+        gzclose(initrd_info.u.file_handle);
+    else if ( fd >= 0 )
        close(fd);
-    if ( initrd_info.u.file_handle )
-        gzclose(initrd_info.u.file_handle);
 
    return sts;

}

tools/libxc/xc_linux_build.c +3 -3
diff -r 9632ececc8f4 tools/libxc/xc_linux_build.c
@@ -1373,10 +1373,10 @@ int xc_linux_build(int xc_handle,
 
  error_out:
     free(image);
-    if ( fd >= 0 )
+    if ( initrd_info.type == INITRD_file && initrd_info.u.file_handle )
+        gzclose(initrd_info.u.file_handle);
+    else if ( fd >= 0 )
         close(fd);
-    if ( initrd_info.u.file_handle )
-        gzclose(initrd_info.u.file_handle);
 
     return sts;
 }

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

#2 lore raw
Quoted 9 lines · Chris Wright
Quoted 2 lines · * Steven Rostedt ([email protected]) wrote:

(this may have white space damage, so I'm attaching the same patch as well. Haven't yet figured out how to do proper inline patches in thunderbird)

This may help:

http://mbligh.org/linuxdocs/Email/Clients/Thunderbird

Actually it doesn't :( I just hate the cut and paste way it makes you do it. Where's my insert file!

BTW, I was even in on the thread that was mentioned. And I may soon put evolution on my Red Hat machine ;)

http://lkml.org/lkml/2005/12/27/177

-- Steve