Re: [PATCH] libdrm: Use readdir instead of readdir_r to avoid build warnings

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

 



On 19 March 2018 at 14:41, Eric Engestrom <eric.engestrom@xxxxxxxxxx> wrote:
> On Monday, 2018-03-19 06:47:32 -0700, John Stultz wrote:
>> Building libdrm under AOSP, we see the following build warning:
>> external/libdrm/xf86drm.c:2861:12: warning: 'readdir_r' is deprecated: readdir_r is deprecated; use readdir instead [-Wdeprecated-declarations]
>>     while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) {
>>            ^
>>
>> Thus, this patch replaces readdir_r with readdir.
>>
>> Cc: Robert Foss <robert.foss@xxxxxxxxxxxxx>
>> Cc: Rob Herring <robh@xxxxxxxxxx>
>> Cc: Stefan Schake <stschake@xxxxxxxxx>
>> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
>> ---
>>  xf86drm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/xf86drm.c b/xf86drm.c
>> index 344326d..b9058c2 100644
>> --- a/xf86drm.c
>> +++ b/xf86drm.c
>> @@ -2858,7 +2858,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
>>      if (pent == NULL)
>>           goto out_close_dir;
>>
>> -    while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) {
>> +    while ((ent = readdir(sysdir))) {
>
> I've had the same patch locally for some time, and while this line is
> correct, it's missing other changes to clean up unnecessary code around.
>
> I don't have the change on this machine, I'll look at it tonight, but if
> you beat me to it, from memory there's a malloc()+free() around, and
> a couple unused variables now that should be removed at the start of
> the scope.
>
Right - updated patch should be in your inbox.

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux