Re: A patch for match_file_string()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alex Sidorenko wrote:
Hi Dave,

on some distributions (e.g. Ubuntu) crash cannot find the live kernel image because of a slight mismatch between kt->proc_version and 'strings' output from namelist file (e.g. /boot/vmlinux-debug-2.6.22-14-generic)

Namely, kt->proc_version is LF-terminated, but there is no LF in 'strings vmlinux' output.

If I strip LF from the end of kt->proc_version, everything works fine

--- filesys.c.orig      2008-02-28 11:09:10.000000000 -0500
+++ filesys.c   2008-03-13 16:33:02.000000000 -0400
@@ -3689,7 +3689,10 @@
        int found;
        char command[BUFSIZE];
        FILE *pipe;
+       int slen = strlen(string);

+       if (slen && string[slen-1] == '\n')
+         string[slen-1] = '\0';

        sprintf(command, "/usr/bin/strings %s", filename);
         if ((pipe = popen(command, "r")) == NULL) {

=====================================================================

Regards,
Alex



Hi Alex,

Help me out here -- when I run it, both kt->proc_version and the buffer
read from the strings output read by fgets() both have linefeeds.

Are you saying that the fgets() call is stripping the linefeed from
the strings output?  The "strings vmlinux" output has to have linefeeds
or else it would be a huge mash of characters.

What am I missing?

Dave

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux