X-Git-Url: http://git.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fpazpar2_play.c;h=5339f2dfcb7e259035a8bf62287880274cc2a8d9;hb=a604a6212609e9b809abd09f91e9f60111f25df7;hp=622885a873b19f34a62cd024e950c28175942cb5;hpb=57e4ad5d9d4b321cbd7af18584f805835226a981;p=pazpar2-moved-to-github.git diff --git a/src/pazpar2_play.c b/src/pazpar2_play.c index 622885a..5339f2d 100644 --- a/src/pazpar2_play.c +++ b/src/pazpar2_play.c @@ -54,6 +54,7 @@ static int run(FILE *inf, struct addrinfo *res) long long id; int sz, r, c; char req[100]; + char request_type[100]; size_t i; struct con **conp; c = fgetc(inf); @@ -66,8 +67,9 @@ static int run(FILE *inf, struct addrinfo *res) c = fgetc(inf); } req[i] = 0; - r = sscanf(req, "%lld %lld %lld %d", &tv_sec1, &tv_usec1, &id, &sz); - if (r != 4) + r = sscanf(req, "%s %lld %lld %lld %d", request_type, + &tv_sec1, &tv_usec1, &id, &sz); + if (r != 5) { fprintf(stderr, "bad line %s\n", req); return -1; @@ -145,11 +147,14 @@ static int run(FILE *inf, struct addrinfo *res) (long long) toread, (long long) r); return -1; } - w = write((*conp)->fd, buf, toread); - if (w != toread) - { - fprintf(stderr, "write truncated\n"); - return -1; + if (*request_type == 'r') + { /* Only deal with things tha Pazpar2 received */ + w = write((*conp)->fd, buf, toread); + if (w != toread) + { + fprintf(stderr, "write truncated\n"); + return -1; + } } cnt += toread; }