errno = 0; /* need to manually reset errno here, for the while loop, funfun */ buf_space=sizeof(buf); /* reset everything */ p_buf=buf; /* continue resettting everything */ while (1) { res=fgets(tbuf, sizeof(tbuf), readf); if (res==NULL) ast_log(LOG_ERROR,"Res was null\n"); ast_build_string(&p_buf,&buf_space,"%s",tbuf); ast_log(LOG_ERROR,"Result: error: %i - tbuf:%s - buf:%s - Space left: %i\n",errno,tbuf,buf,buf_spac$ if (errno) ast_log(LOG_ERROR,"Error: %s",strerror(errno)); if (errno!=EAGAIN) break; errno = 0; /* must manually reset this again so we can check the following fgets read */ tbuf[0]='\0'; }