From 676e563ff78c9df5ee3a7ad0aa2d019465d54373 Mon Sep 17 00:00:00 2001 From: snar Date: Tue, 20 May 2008 15:57:22 +0000 Subject: [PATCH] Solaris: tested and does not works.. --- bgpq_expander.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bgpq_expander.c b/bgpq_expander.c index d468478..7fb667a 100644 --- a/bgpq_expander.c +++ b/bgpq_expander.c @@ -37,6 +37,12 @@ bgpq_expander_init(struct bgpq_expander* b, int af) b->name="NN"; b->aswidth=8; b->asn32s[0]=malloc(8192); + if(!b->asn32s[0]) { + sx_report(SX_FATAL,"Unable to allocate 8192 bytes: %s\n", + strerror(errno)); + exit(1); + }; + memset(b->asn32s[0],0,8192); return 1; fixups: @@ -212,6 +218,7 @@ bgpq_pipeline_dequeue_ripe(FILE* f, struct bgpq_expander* b) }; }; }; + fseek(f,0,SEEK_END); }; if(feof(f)) { sx_report(SX_FATAL,"EOF from RADB\n"); @@ -319,6 +326,7 @@ bgpq_pipeline(FILE* f, int (*callback)(char*, void*), void* udata, }; memset(bp,0,sizeof(bp)); + fseek(f,0,SEEK_END); ret=fwrite(request,1,strlen(request),f); fseek(f,0,SEEK_END); @@ -359,6 +367,7 @@ bgpq_pipeline_dequeue(FILE* f, struct bgpq_expander* b) }; exit(1); }; + fseek(f,0,SEEK_END); if(request[0]=='A') { char* eon, *c; @@ -379,6 +388,7 @@ bgpq_pipeline_dequeue(FILE* f, struct bgpq_expander* b) }; exit(1); }; + fseek(f,0,SEEK_END); for(c=recvbuffer; cpiped--; free(pipe); + fseek(f,0,SEEK_END); }; return 0; }; @@ -436,6 +448,7 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata, SX_DEBUG(debug_expander,"expander: sending '%s'\n", request); + fseek(f,0,SEEK_END); ret=fwrite(request,1,strlen(request),f); fseek(f,0,SEEK_END); if(ret!=strlen(request)) { @@ -455,6 +468,7 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata, }; SX_DEBUG(debug_expander>2,"expander: initially got %i bytes, '%s'\n", strlen(request),request); + fseek(f,0,SEEK_END); if(request[0]=='A') { char* eon, *c; long togot=strtoul(request+1,&eon,10); @@ -476,6 +490,7 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata, }; SX_DEBUG(debug_expander>2,"expander: final reply of %i bytes, '%s'\n", strlen(recvbuffer),recvbuffer); + fseek(f,0,SEEK_END); for(c=recvbuffer; csources); fseek(f,0,SEEK_END); fwrite(sources,strlen(sources),1,f); + fseek(f,0,SEEK_END); fgets(sources,sizeof(sources),f); };