This was noticed at https://bugs.busybox.net/show_bug.cgi?id=4099
where GNU coreutils cut fails like:
$echo '3:0:0:' | cut -d : -f 2
30
The reason is because GNU cut uses ungetc(),
and that wasn't handled appropriately on uClibc
when __UCLIBC_HAS_STDIO_GETC_MACRO__ is not defined.
* lib/freadptr.c (freadptr): Return NULL if there are
ungotten chars. In this case freadseek() will iterate
again to process the ungotten character.
+2015-12-08 Pádraig Brady <P@draigBrady.com>
+
+ fix freadptr to work with ungetc on all uClibc configs
+ Reported at https://bugs.busybox.net/show_bug.cgi?id=4099
+ where GNU coreutils cut(1) generates invalid output on uClibc
+ when __UCLIBC_HAS_STDIO_GETC_MACRO__ is not defined.
+ * lib/freadptr.c (freadptr): Return NULL if there are
+ ungotten chars. In this case freadseek() will iterate
+ again to process the ungotten character.
+
2015-11-13 Paul Eggert <eggert@cs.ucla.edu>
xalloc-oversized: improve performance with GCC 5
# ifdef __STDIO_BUFFERS
if (fp->__modeflags & __FLAG_WRITING)
return NULL;
+ if (fp->__modeflags & __FLAG_UNGOT)
+ return NULL;
size = fp->__bufread - fp->__bufpos;
if (size == 0)
return NULL;