Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-29 Thread Alejandro Colomar
On 2020-09-29 15:38, Michael Kerrisk (man-pages) wrote: 2.- Use sizeof() everywhere, and the macro for the initializer. pros: - It is valid as long as the buffer is an array. cons: - If the code gets into a function, and the buffer is then a pointer, it will definitively produce a

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-29 Thread Michael Kerrisk (man-pages)
> 2.- Use sizeof() everywhere, and the macro for the initializer. > > pros: > - It is valid as long as the buffer is an array. > cons: > - If the code gets into a function, and the buffer is then a pointer, >it will definitively produce a silent bug. Sigh! I just did exactly the last

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-24 Thread Alejandro Colomar
Hi Michael, On 2020-09-24 13:38, Michael Kerrisk (man-pages) wrote: > On 9/24/20 11:35 AM, Alejandro Colomar wrote: >> Hi, >> >> On 2020-09-23 22:35, Michael Kerrisk (man-pages) wrote: >>> On 9/15/20 12:03 PM, Stefan Puiu wrote: Hi, On Fri, Sep 11, 2020 at 6:28 PM Alejandro

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-24 Thread Michael Kerrisk (man-pages)
On 9/24/20 11:35 AM, Alejandro Colomar wrote: > Hi, > > On 2020-09-23 22:35, Michael Kerrisk (man-pages) wrote: >> On 9/15/20 12:03 PM, Stefan Puiu wrote: >>> Hi, >>> >>> On Fri, Sep 11, 2020 at 6:28 PM Alejandro Colomar >>> wrote: Hi Stefan, On 2020-09-11 16:35, Stefan Puiu

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-24 Thread Alejandro Colomar
Hi Michael On 2020-09-24 12:04, Michael Kerrisk (man-pages) wrote: Hi Alex, [..] I was reverting the 3 patches I introduced (they changed from solution 1 to solution 2), and also was grepping for already existing solution 2 in the pages (it seems that solution 2 was a bit more extended than

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-24 Thread Michael Kerrisk (man-pages)
Hi Alex, [..] > I was reverting the 3 patches I introduced (they changed from solution 1 > to solution 2), and also was grepping for already existing solution 2 in > the pages (it seems that solution 2 was a bit more extended than > solution 1). Just so I can refresh my cache, which commits

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-24 Thread Alejandro Colomar
Hi, On 2020-09-23 22:35, Michael Kerrisk (man-pages) wrote: On 9/15/20 12:03 PM, Stefan Puiu wrote: Hi, On Fri, Sep 11, 2020 at 6:28 PM Alejandro Colomar wrote: Hi Stefan, On 2020-09-11 16:35, Stefan Puiu wrote: > Hi, > > On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar >

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-23 Thread Michael Kerrisk (man-pages)
On 9/15/20 12:03 PM, Stefan Puiu wrote: > Hi, > > On Fri, Sep 11, 2020 at 6:28 PM Alejandro Colomar > wrote: >> >> Hi Stefan, >> >> On 2020-09-11 16:35, Stefan Puiu wrote: >> > Hi, >> > >> > On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar >> > wrote: >> >> >> >> Signed-off-by:

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-15 Thread Stefan Puiu
Hi, On Fri, Sep 11, 2020 at 6:28 PM Alejandro Colomar wrote: > > Hi Stefan, > > On 2020-09-11 16:35, Stefan Puiu wrote: > > Hi, > > > > On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar > > wrote: > >> > >> Signed-off-by: Alejandro Colomar > >> --- > >> man3/getgrent_r.3 | 2 +- >

Re: AW: AW: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-14 Thread Alejandro Colomar
Hi Walter, On 9/14/20 11:24 AM, Walter Harms wrote: > missunderstanding, > i do not want to discuss sizeof() vs define I did understand, that was point (3). > > in this example you do: > #define BUFLEN 4096 > char buf[BUFLEN]; > getgrent_r(, buf, sizeof(buf), ); > > so there is no real need

AW: AW: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-14 Thread Walter Harms
LEN Von: Alejandro Colomar [colomar.6@gmail.com] Gesendet: Freitag, 11. September 2020 21:17 An: Walter Harms; mtk.manpa...@gmail.com Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org Betreff: Re: AW: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (inst

Re: AW: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Alejandro Colomar
Hi Walter, On 2020-09-11 14:50, Walter Harms wrote: BUFLEN should be remove completely or stay jm2c wh Sorry that you weren't CC'd in the conversation we are having about it. You can have a look at it here:

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Alejandro Colomar
On 2020-09-11 17:28, Alejandro Colomar wrote: Hi Stefan, On 2020-09-11 16:35, Stefan Puiu wrote: > Hi, > > On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar > wrote: >> >> Signed-off-by: Alejandro Colomar >> --- >>   man3/getgrent_r.3 | 2 +- >>   1 file changed, 1 insertion(+), 1

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Stefan Puiu
Hi, On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar wrote: > > Signed-off-by: Alejandro Colomar > --- > man3/getgrent_r.3 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/man3/getgrent_r.3 b/man3/getgrent_r.3 > index 81d81a851..76deec370 100644 > ---

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Alejandro Colomar
Hi Stefan, On 2020-09-11 16:35, Stefan Puiu wrote: > Hi, > > On Fri, Sep 11, 2020 at 12:15 AM Alejandro Colomar > wrote: >> >> Signed-off-by: Alejandro Colomar >> --- >> man3/getgrent_r.3 | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/man3/getgrent_r.3

AW: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Walter Harms
...@gmail.com Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; Alejandro Colomar Betreff: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name) Signed-off-by: Alejandro Colomar --- man3/getgrent_r.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/10/20 11:13 PM, Alejandro Colomar wrote: > Signed-off-by: Alejandro Colomar Thanks, Alex. Patch applied. Cheers, Michael > --- > man3/getgrent_r.3 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/man3/getgrent_r.3 b/man3/getgrent_r.3 > index 81d81a851..76deec370

[PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-10 Thread Alejandro Colomar
Signed-off-by: Alejandro Colomar --- man3/getgrent_r.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man3/getgrent_r.3 b/man3/getgrent_r.3 index 81d81a851..76deec370 100644 --- a/man3/getgrent_r.3 +++ b/man3/getgrent_r.3 @@ -186,7 +186,7 @@ main(void) setgrent();