Re: pciutils pci_open seg with invalid arg to -i

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

 



Hi!

> So I was going to suggest something like:
> 
>  33   if (len < 3 || memcmp(a->id_file_name + len - 3, ".gz", 3) != 0)
>  34     return result;

Yes, that's right.

Please try the current version in the Git repository, it's fixed there.

> which would mean that it would drop out if it was a short filename; but
> then I started to try and understand the code more; it looks to me like:
> 
>    try and gzopen it.
>    if that fails
>      check it ended with a .gz (else fail)
>      strip the .gz off the end
>      gzopen it without the .gz
> 
> But why bother?  According to the zlib manual for gzopen :
>   ( http://www.zlib.net/manual.html )
>      
> ' gzopen can be used to read a file which is not in gzip format; in this case
> gzread will directly read from the file without decompression. When reading,
> this will be detected automatically by looking for the magic two-byte gzip
> header. '
> 
> So what are lines 32-39 trying to do?

When somebody specifies a file name like "pci.ids.gz" (or it's the default name)
and no such file exists, it tries the same name without ".gz".

				Have a nice fortnight
-- 
Martin `MJ' Mares                          <mj@xxxxxx>   http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
Weather forecast for tonight: dark.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux