Fails to build in Ubuntu Jaunty: doesn't check return value of write()

Bug #300361 reported by James Westby
4
Affects Status Importance Assigned to Milestone
btnx
New
Undecided
Unassigned
btnx (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Hi,

At

  http://launchpadlibrarian.net/19657063/buildlog_ubuntu-jaunty-i386.btnx_0.4.11-1_FAILEDTOBUILD.txt.gz

you can see that btnx failed to build in Ubuntu Jaunty. It has a stricter compiler
that warns about failing to check the return values of some functions. btnx
compiles with -Werror, so this fails the build.

write() returns the number of bytes written, or -1 on error, with errno being set.

While it would be possible to avoid the compile failure by not building with -Werror
it would be great to fix this, particularly as it is a bug waiting to happen.

Thanks,

James

Tags: ftbfs patch
James Westby (james-w)
Changed in btnx:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Stefan Lesicnik (stefanlsd) wrote :

Capture the return value of the write(). This fixes a FTBFS on Jaunty which uses -Werror.

The alternative is to do some proper checking if the buffer is successfully written. In the case of the information coming from a struct with set values, the likelyhood of not getting all the data is highly unlikely, hence just captured and ignored.

Revision history for this message
Stefan Lesicnik (stefanlsd) wrote :

Probably a better fix....

Changed in btnx:
status: New → Invalid
James Westby (james-w)
Changed in btnx:
status: Invalid → New
Changed in btnx:
status: New → Invalid
Revision history for this message
Onkar Shinde (onkarshinde) wrote :

For now I am accepting the first debdiff. It will be great if you can submit your 'better' fix to upstream.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package btnx - 0.4.11-1ubuntu1

---------------
btnx (0.4.11-1ubuntu1) jaunty; urgency=low

  * Capture the return value of the write(). Fixes FTBFS.
    (LP: #300361)

 -- Stefan Lesicnik <email address hidden> Mon, 09 Feb 2009 22:10:12 +0200

Changed in btnx:
status: Triaged → Fix Released
Revision history for this message
James Westby (james-w) wrote :

Please stop closing the btnx task, btnx uses launchpad for bug reports, so
it is already forwarded.

Thanks,

James

Changed in btnx:
status: Invalid → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.