Bug#367849: glibc-doc: rpmatch() example has wrong use of getline()
Package: glibc-doc
Version: 2.3.6-7
Severity: normal
Tags: patch
File: file:///usr/share/doc/glibc-doc/html/libc_7.html#SEC121
The example code has:
while (getline (&line, &len, stdout) >= 0)
which causes getline() to try to read from stdout, causing an error,
and the result is always a return value of -1. Of course it should be
stdin.
--- locale.texi 2002-06-29 23:35:21.000000000 -0400
+++ new/locale.texi 2006-05-17 19:03:01.000000000 -0400
@@ -1210,7 +1210,7 @@
/* @r{Prepare the @code{getline} call.} */
line = NULL;
len = 0;
- while (getline (&line, &len, stdout) >= 0)
+ while (getline (&line, &len, stdin) >= 0)
@{
/* @r{Check the response.} */
int res = rpmatch (line);
Reply to: