recv_image.c:129 : error: storage size of 'rq' isn't known

Bug Description

Binary package hint: mtd-utils

We didn't find the mtd-utils package in Ubuntu intrepid.

We found this page (https://edge.launchpad.net/ubuntu/intrepid/+source/mtd-utils/20080508-1) that points a build fail.

In the following page we found the error: http://launchpadlibrarian.net/17423696/buildlog_ubuntu-intrepid-i386.mtd-utils_20080508-1_FAILEDTOBUILD.txt.gz

==============
recv_image.c: In function 'main':
recv_image.c:129: error: storage size of 'rq' isn't known
recv_image.c:129: warning: unused variable 'rq'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'uint32_t'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 3 has type 'uint32_t'
recv_image.c:311: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'uint32_t'
make[1]: *** [recv_image.o] Error 1
==============

We start to investigate and we found that the struct "struct ip_mreq" is defined in "#include <netinet/in.h>" only if "__USE_MISC or __USE_GNU" are defined.
But we cannot define one of them directly in recv_image.c as the header feature.h undefine them and it just redefine __USE_GNU if _GNU_SOURCE is defined. So we just need to define _GNU_SOURCE symbol.

We found the wrong define" #define _USE_MISC" (note the suffix _ instead of __) that is not being used for anything. So our patch switch the define from _USE_MISC to _GNU_SOURCE

There is a patch in upstream (http://git.infradead.org/mtd-utils.git?a=commitdiff;h=b995f89a81589be8d8a41c374a6df109d0ee12b3) to fix the same error BUT we think it's wrong to define "__USE_*" symbols, as <features.h> would undefine them. It is working just because the define is just before the <netinet/in.h> include.

Both patches have also a change in a printf line, just to remove some copiler warnings.

IS VERY important that mtd-utils package being included in universe repository again, we think many people use these tools. It includes, for instance, the binary mkfs.jffs2, very important to research in embedded systems.

Lauro Venancio <email address hidden> and Aloisio Almeida Jr <email address hidden> are the authors of this research and patch

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值