Fix minor compilation issues on CentOS.

- ensure size_t is defined when compiling xprintf.h
- declare overlay_route_record as a union field in overlay_route_record to avoid alignment issues
- set the result of fwrite and fputs
- support slightly older git version
This commit is contained in:
Jeremy Lakeman 2014-10-20 11:58:40 +10:30
parent fd0b7eda59
commit bcd9575b54
6 changed files with 10 additions and 6 deletions

View File

@ -106,7 +106,10 @@ struct overlay_mdp_data_frame {
uint16_t payload_length;
int queue;
int ttl;
unsigned char payload[MDP_MTU-100];
union{
unsigned char payload[MDP_MTU-100];
struct overlay_route_record route_record;
};
};
struct overlay_mdp_error {

View File

@ -459,7 +459,7 @@ static int app_route_print(const struct cli_parsed *parsed, struct cli_context *
int ofs=0;
while(ofs + sizeof(struct overlay_route_record) <= rx.out.payload_length){
struct overlay_route_record *p=(struct overlay_route_record *)&rx.out.payload[ofs];
struct overlay_route_record *p=&rx.out.route_record;
ofs+=sizeof(struct overlay_route_record);
if (p->reachable==REACHABLE_NONE)

View File

@ -1145,7 +1145,7 @@ static int routing_table(struct subscriber *subscriber, void *context)
overlay_mdp_frame reply;
bzero(&reply, sizeof(overlay_mdp_frame));
struct overlay_route_record *r=(struct overlay_route_record *)&reply.out.payload;
struct overlay_route_record *r=&reply.out.route_record;
reply.packetTypeAndFlags=MDP_TX;
reply.out.payload_length=sizeof(struct overlay_route_record);
r->sid = subscriber->sid;

View File

@ -113,8 +113,8 @@ int main(int argc, char **argv)
unsigned remain = size - offset - 1;
if (remain > sizeof buf)
remain = sizeof buf;
fwrite(buf, remain, 1, stdout);
fputc('\n', stdout);
int r=fwrite(buf, remain, 1, stdout);
r=fputc('\n', stdout);
offset += remain + 1;
if (bounce <= n || bounce >= bouncemax)
bouncedelta *= -1;

View File

@ -154,7 +154,7 @@ case "$error" in
*[Nn]'o tags can describe'* | \
*[Cc]'annot describe'* )
if [ -n "$default_tag" ]; then
commit=$(git rev-list --abbrev-commit --max-count 1 ${refspec:-HEAD})
commit=$(git rev-list --abbrev-commit --max-count=1 ${refspec:-HEAD})
count=$(( $(git rev-list ${refspec:-HEAD} | wc -l) - 1 ))
echo "$default_tag-$count-g$commit$dirty"
exit 0

View File

@ -62,6 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdarg.h>
#include <unistd.h>
typedef void CONTEXT_VPRINTF(void *context, const char *fmt, va_list);