osmocom-bb[master]: mobile/gsm322.c: check fwrite() return value

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed May 17 21:36:56 UTC 2017


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/2660/2/src/host/layer23/src/mobile/gsm322.c
File src/host/layer23/src/mobile/gsm322.c:

Line 5150: 			rc += fwrite(buf, 4, 1, fp);
> I'm not sure if addition is a good idea.  Example: First fwrite() returns 3
I relied on the man page:

> On  success,  fread()  and  fwrite() return the number of items read or
> written.  This number equals the number of bytes transferred only  when
> size  is 1.  If an error occurs, or the end of the file is reached, the
> return value is a short item count (or zero).

As we have nmemb = 1 in both cases, fwrite can only return 0 or 1.
Am I wrong?


-- 
To view, visit https://gerrit.osmocom.org/2660
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list