code: plan9front

Download patch

ref: 5fd4fa912ef622333b38268786ff4609c81f2ec9
parent: f2974b6cfaec397279c939e41160c0073ac1ab05
author: Michael Forney <mforney@mforney.org>
date: Thu Feb 11 04:37:36 EST 2021

[9front] audio/flacenc: fix error check for fseeko
fseeko returns 0 on success, not the new stream position.

This allows flacenc to update the streaminfo block when it is finished
(for example to set the number of samples and checksum).

--- a/sys/src/cmd/audio/flacenc/flacenc.c
+++ b/sys/src/cmd/audio/flacenc/flacenc.c
@@ -18,7 +18,7 @@
 static FLAC__StreamEncoderSeekStatus
 encseek(FLAC__StreamEncoder *enc, FLAC__uint64 absolute_byte_offset, void *client_data)
 {
-	return fseeko(stdout, absolute_byte_offset, SEEK_SET) != absolute_byte_offset ?
+	return fseeko(stdout, absolute_byte_offset, SEEK_SET) != 0 ?
 		FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED :
 		FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
 }