testlayer3: Normalize successful write() return value in bch_worker()

bch_worker() on {DL,PH}_DATA_IND returns what write() call has returned.
This function returns number of bytes written, however bch_worker() caller
main_worker() treats any non-zero return value of bch_worker() as signal
to disconnect the call.

This all meant that call terminated on first received chunk of data.

Fix it by normalizing a positive return value of write() in bch_worker()
to zero.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
This commit is contained in:
Maciej S. Szmigiero 2016-03-18 22:44:32 +01:00 committed by Karsten Keil
parent 99bccfa7b9
commit 0cac6f5176
1 changed files with 2 additions and 0 deletions

View File

@ -1296,6 +1296,8 @@ static int bch_worker(devinfo_t *di)
ret = write(di->save, buf + MISDN_HEADER_LEN, len - MISDN_HEADER_LEN);
if (ret < 0)
fprintf(stderr,"got error on write %s\n", strerror(errno));
else
ret = 0;
break;
case PH_DATA_CNF:
/* get ACK of send data, so we can