* [PATCH] getline.3: wfix
@ 2017-07-12 8:10 Long Wang
[not found] ` <1499847001-83794-1-git-send-email-w-m92B/FuLcaEcWVvVuXF20w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Long Wang @ 2017-07-12 8:10 UTC (permalink / raw)
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA
Signed-off-by: Long Wang <w@laoqinren.net>
---
man3/getline.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man3/getline.3 b/man3/getline.3
index 7483afd..9bc4d8e 100644
--- a/man3/getline.3
+++ b/man3/getline.3
@@ -173,7 +173,7 @@ main(int argc, char *argv[])
ssize_t nread;
if (argc != 2) {
- fprintf(stderr, "Usage: %s <file>\en", argv[1]);
+ fprintf(stderr, "Usage: %s <file>\en", argv[0]);
exit(EXIT_FAILURE);
}
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread[parent not found: <1499847001-83794-1-git-send-email-w-m92B/FuLcaEcWVvVuXF20w@public.gmane.org>]
* Re: [PATCH] getline.3: wfix [not found] ` <1499847001-83794-1-git-send-email-w-m92B/FuLcaEcWVvVuXF20w@public.gmane.org> @ 2017-07-12 17:36 ` Michael Kerrisk (man-pages) 0 siblings, 0 replies; 8+ messages in thread From: Michael Kerrisk (man-pages) @ 2017-07-12 17:36 UTC (permalink / raw) To: Long Wang Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA On 07/12/2017 10:10 AM, Long Wang wrote: > Signed-off-by: Long Wang <w@laoqinren.net> Thanks, Long. Patch applied. Cheers, Michael > --- > man3/getline.3 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/man3/getline.3 b/man3/getline.3 > index 7483afd..9bc4d8e 100644 > --- a/man3/getline.3 > +++ b/man3/getline.3 > @@ -173,7 +173,7 @@ main(int argc, char *argv[]) > ssize_t nread; > > if (argc != 2) { > - fprintf(stderr, "Usage: %s <file>\en", argv[1]); > + fprintf(stderr, "Usage: %s <file>\en", argv[0]); > exit(EXIT_FAILURE); > } > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] getline.3: wfix. @ 2022-07-29 20:22 enh 2022-07-29 20:52 ` G. Branden Robinson 2022-08-01 12:53 ` Alejandro Colomar 0 siblings, 2 replies; 8+ messages in thread From: enh @ 2022-07-29 20:22 UTC (permalink / raw) To: linux-man, Alejandro Colomar (man-pages), Michael Kerrisk (man-pages) Clarify in the RETURN VALUE section that it's necessary to free the buffer, since at least one person missed this up at the start of the DESCRIPTION. Signed-off-by: Elliott Hughes <enh@google.com> --- man3/getline.3 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man3/getline.3 b/man3/getline.3 index 8b7357825..bad30956c 100644 --- a/man3/getline.3 +++ b/man3/getline.3 @@ -99,6 +99,10 @@ condition). In the event of a failure, .I errno is set to indicate the error. +If +.I "*lineptr" +was set to NULL before the call, then the buffer should be freed by the +user program even on failure. .SH ERRORS .TP .B EINVAL -- 2.37.1.455.g008518b4e5-goog ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] getline.3: wfix. 2022-07-29 20:22 enh @ 2022-07-29 20:52 ` G. Branden Robinson 2022-07-29 20:55 ` enh 2022-08-01 12:53 ` Alejandro Colomar 1 sibling, 1 reply; 8+ messages in thread From: G. Branden Robinson @ 2022-07-29 20:52 UTC (permalink / raw) To: enh; +Cc: linux-man, Alejandro Colomar (man-pages), Michael Kerrisk (man-pages) [-- Attachment #1: Type: text/plain, Size: 442 bytes --] Hi Elliott, At 2022-07-29T13:22:22-0700, enh wrote: > Clarify in the RETURN VALUE section that it's necessary to free the > buffer, since at least one person missed this up at the start of the > DESCRIPTION. [...] > +If > +.I "*lineptr" The quotation marks are unnecessary; macro arguments are space-delimited and you have none here. (Even if you had multiple arguments, macros like `B` and `I` treat them all the same.) Regards, Branden [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] getline.3: wfix. 2022-07-29 20:52 ` G. Branden Robinson @ 2022-07-29 20:55 ` enh 0 siblings, 0 replies; 8+ messages in thread From: enh @ 2022-07-29 20:55 UTC (permalink / raw) To: G. Branden Robinson Cc: linux-man, Alejandro Colomar (man-pages), Michael Kerrisk (man-pages) i actually just copy & pasted that from the top of the file :-) On Fri, Jul 29, 2022 at 1:52 PM G. Branden Robinson <g.branden.robinson@gmail.com> wrote: > > Hi Elliott, > > At 2022-07-29T13:22:22-0700, enh wrote: > > Clarify in the RETURN VALUE section that it's necessary to free the > > buffer, since at least one person missed this up at the start of the > > DESCRIPTION. > [...] > > +If > > +.I "*lineptr" > > The quotation marks are unnecessary; macro arguments are space-delimited > and you have none here. (Even if you had multiple arguments, macros > like `B` and `I` treat them all the same.) > > Regards, > Branden ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] getline.3: wfix. 2022-07-29 20:22 enh 2022-07-29 20:52 ` G. Branden Robinson @ 2022-08-01 12:53 ` Alejandro Colomar 2022-08-02 21:17 ` enh 1 sibling, 1 reply; 8+ messages in thread From: Alejandro Colomar @ 2022-08-01 12:53 UTC (permalink / raw) To: enh, linux-man; +Cc: G. Branden Robinson [-- Attachment #1.1: Type: text/plain, Size: 1013 bytes --] Hi enh, On 7/29/22 22:22, enh wrote: > Clarify in the RETURN VALUE section that it's necessary to free the > buffer, since at least one person missed this up at the start of the > DESCRIPTION. > > Signed-off-by: Elliott Hughes <enh@google.com> > --- > man3/getline.3 | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/man3/getline.3 b/man3/getline.3 > index 8b7357825..bad30956c 100644 > --- a/man3/getline.3 > +++ b/man3/getline.3 > @@ -99,6 +99,10 @@ condition). > In the event of a failure, > .I errno > is set to indicate the error. .PP Since the added text has nothing to do with the previous, let's separate them into separate paragraphs. > +If > +.I "*lineptr" As Branden said, please remove the unnecessary quotes. > +was set to NULL before the call, then the buffer should be freed by the > +user program even on failure. > .SH ERRORS > .TP > .B EINVAL Cheers, Alex -- Alejandro Colomar <http://www.alejandro-colomar.es/> [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] getline.3: wfix. 2022-08-01 12:53 ` Alejandro Colomar @ 2022-08-02 21:17 ` enh 2022-08-15 21:16 ` Alejandro Colomar 0 siblings, 1 reply; 8+ messages in thread From: enh @ 2022-08-02 21:17 UTC (permalink / raw) To: Alejandro Colomar; +Cc: linux-man, G. Branden Robinson ack. i've fixed all the other instances of `.I "foo"` in that file too... Date: Fri, 29 Jul 2022 13:13:10 -0700 Subject: [PATCH] getline.3: wfix. Clarify in the RETURN VALUE section that it's necessary to free the buffer, since at least one person missed this up at the start of the DESCRIPTION. Signed-off-by: Elliott Hughes <enh@google.com> --- man3/getline.3 | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/man3/getline.3 b/man3/getline.3 index 8b7357825..cb9e5b049 100644 --- a/man3/getline.3 +++ b/man3/getline.3 @@ -36,12 +36,12 @@ Feature Test Macro Requirements for glibc (see .BR getline () reads an entire line from \fIstream\fP, storing the address of the buffer containing the text into -.IR "*lineptr" . +.IR *lineptr . The buffer is null-terminated and includes the newline character, if one was found. .PP If -.I "*lineptr" +.I *lineptr is set to NULL before the call, then .BR getline () will allocate a buffer for storing the line. @@ -52,26 +52,26 @@ failed. .PP Alternatively, before calling .BR getline (), -.I "*lineptr" +.I *lineptr can contain a pointer to a .BR malloc (3)\-allocated buffer -.I "*n" +.I *n bytes in size. If the buffer is not large enough to hold the line, .BR getline () resizes it with .BR realloc (3), updating -.I "*lineptr" +.I *lineptr and -.I "*n" +.I *n as necessary. .PP In either case, on a successful call, -.I "*lineptr" +.I *lineptr and -.I "*n" +.I *n will be updated to reflect the buffer address and allocated size respectively. .PP .BR getdelim () @@ -99,6 +99,11 @@ condition). In the event of a failure, .I errno is set to indicate the error. +.PP +If +.I *lineptr +was set to NULL before the call, then the buffer should be freed by the +user program even on failure. .SH ERRORS .TP .B EINVAL -- 2.37.1.455.g008518b4e5-goog On Mon, Aug 1, 2022 at 5:54 AM Alejandro Colomar <alx.manpages@gmail.com> wrote: > > Hi enh, > > On 7/29/22 22:22, enh wrote: > > Clarify in the RETURN VALUE section that it's necessary to free the > > buffer, since at least one person missed this up at the start of the > > DESCRIPTION. > > > > Signed-off-by: Elliott Hughes <enh@google.com> > > --- > > man3/getline.3 | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/man3/getline.3 b/man3/getline.3 > > index 8b7357825..bad30956c 100644 > > --- a/man3/getline.3 > > +++ b/man3/getline.3 > > @@ -99,6 +99,10 @@ condition). > > In the event of a failure, > > .I errno > > is set to indicate the error. > > .PP > > Since the added text has nothing to do with the previous, let's separate > them into separate paragraphs. > > > +If > > +.I "*lineptr" > > As Branden said, please remove the unnecessary quotes. > > > +was set to NULL before the call, then the buffer should be freed by the > > +user program even on failure. > > .SH ERRORS > > .TP > > .B EINVAL > > Cheers, > > Alex > > -- > Alejandro Colomar > <http://www.alejandro-colomar.es/> ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] getline.3: wfix. 2022-08-02 21:17 ` enh @ 2022-08-15 21:16 ` Alejandro Colomar 0 siblings, 0 replies; 8+ messages in thread From: Alejandro Colomar @ 2022-08-15 21:16 UTC (permalink / raw) To: enh; +Cc: linux-man, G. Branden Robinson [-- Attachment #1.1: Type: text/plain, Size: 2308 bytes --] Hi Elliott, On 8/2/22 23:17, enh wrote: > ack. i've fixed all the other instances of `.I "foo"` in that file too... > > Date: Fri, 29 Jul 2022 13:13:10 -0700 > Subject: [PATCH] getline.3: wfix. > > Clarify in the RETURN VALUE section that it's necessary to free the > buffer, since at least one person missed this up at the start of the > DESCRIPTION. > > Signed-off-by: Elliott Hughes <enh@google.com> I broke your patch into two separate patches, and applied them both. Thanks, Alex > --- > man3/getline.3 | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/man3/getline.3 b/man3/getline.3 > index 8b7357825..cb9e5b049 100644 > --- a/man3/getline.3 > +++ b/man3/getline.3 > @@ -36,12 +36,12 @@ Feature Test Macro Requirements for glibc (see > .BR getline () > reads an entire line from \fIstream\fP, > storing the address of the buffer containing the text into > -.IR "*lineptr" . > +.IR *lineptr . > The buffer is null-terminated and includes the newline character, if > one was found. > .PP > If > -.I "*lineptr" > +.I *lineptr > is set to NULL before the call, then > .BR getline () > will allocate a buffer for storing the line. > @@ -52,26 +52,26 @@ failed. > .PP > Alternatively, before calling > .BR getline (), > -.I "*lineptr" > +.I *lineptr > can contain a pointer to a > .BR malloc (3)\-allocated > buffer > -.I "*n" > +.I *n > bytes in size. > If the buffer is not large enough to hold the line, > .BR getline () > resizes it with > .BR realloc (3), > updating > -.I "*lineptr" > +.I *lineptr > and > -.I "*n" > +.I *n > as necessary. > .PP > In either case, on a successful call, > -.I "*lineptr" > +.I *lineptr > and > -.I "*n" > +.I *n > will be updated to reflect the buffer address and allocated size respectively. > .PP > .BR getdelim () > @@ -99,6 +99,11 @@ condition). > In the event of a failure, > .I errno > is set to indicate the error. > +.PP > +If > +.I *lineptr > +was set to NULL before the call, then the buffer should be freed by the > +user program even on failure. > .SH ERRORS > .TP > .B EINVAL -- Alejandro Colomar <http://www.alejandro-colomar.es/> [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-08-16 1:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12 8:10 [PATCH] getline.3: wfix Long Wang
[not found] ` <1499847001-83794-1-git-send-email-w-m92B/FuLcaEcWVvVuXF20w@public.gmane.org>
2017-07-12 17:36 ` Michael Kerrisk (man-pages)
-- strict thread matches above, loose matches on Subject: below --
2022-07-29 20:22 enh
2022-07-29 20:52 ` G. Branden Robinson
2022-07-29 20:55 ` enh
2022-08-01 12:53 ` Alejandro Colomar
2022-08-02 21:17 ` enh
2022-08-15 21:16 ` Alejandro Colomar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox