[Libguestfs] [PATCH common v2] utils: Fix usage of strerror_r

Laszlo Ersek lersek at redhat.com
Thu Dec 9 13:20:50 UTC 2021


On 12/09/21 10:09, Richard W.M. Jones wrote:
> On Thu, Dec 09, 2021 at 09:05:45AM +0000, Richard W.M. Jones wrote:
>> diff --git a/utils/guestfs-utils.h b/utils/guestfs-utils.h
>> index b5f5f3ca4..b1d923e0e 100644
>> --- a/utils/guestfs-utils.h
>> +++ b/utils/guestfs-utils.h
>> @@ -67,6 +67,7 @@ extern int guestfs_int_is_lnk (int64_t mode);
>>  extern int guestfs_int_is_sock (int64_t mode);
>>  extern char *guestfs_int_full_path (const char *dir, const char *name);
>>  extern void guestfs_int_hexdump (const void *data, size_t len, FILE *fp);
>> +const char *guestfs_int_strerror (int errnum, char *buf, size_t buflen);
> 
> That should be extern.  I wonder why that didn't give an error?

Because it's not required. ISO C99, "6.2.2 Linkages of identifiers",
paragraph 5:

    If the declaration of an identifier for a function has no
    storage-class specifier, its linkage is determined exactly as if it
    were declared with the storage-class specifier extern. [...]

> Anyway, fixed in my local copy.

I do agree it's better to be consistent.

Laszlo




More information about the Libguestfs mailing list