[patch] Skip offsets when reading resolution files
Rafael Espindola
espindola@google.com
Tue Nov 17 15:29:00 GMT 2009
> What is the 60 magic value?
The size of an archive header. Richard thinks "ar.h" is not portable.
I factored it a bit better.
>> internal_error ("unexpected file name %s in linker resolution file. "
>> - "Expected %s", obj_name, file_name);
>> + "Expected %s", obj_name, file->filename);
>> + if (file->offset != 0)
>> + {
>> + int t;
>> + char offset_p[21];
>
> You need a buffer longer than 21 (the '@').
It is not read into the buffer. The scanf argument is "@%20s". The @
is only checked and skipped.
>> + long long offset;
>> + t = fscanf(resolution, "@%20s", offset_p);
>> + if (t != 1)
>> + internal_error ("could not parse file offset");
>> + errno = 0;
>> + offset = strtoll(offset_p, NULL, 10);
>
> Space before '('.
Done.
Updated patch attached.
>
> Diego.
>
Cheers,
--
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: offset.patch
Type: text/x-diff
Size: 4117 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091117/8c125509/attachment.bin>
More information about the Gcc-patches
mailing list