Re: New procps release soon
"Craig Small" <[email protected]> ("csmall") Thu, 3 Oct 2024 19:24:54 +1000
| Newsgroups | gmane.linux.procps.devel |
|---|---|
| Message-ID | <CALy8Cw6cEz1oC8YBWeim+UKVmcOB8dh83K0EEtPXePvOOb-fEA@mail.gmail.com> |
--00000000000043ce1006238f2159 Content-Type: text/plain; charset="UTF-8" On Mon, 30 Sept 2024 at 19:21, Dr. Werner Fink <[email protected]> wrote: > but AFAICR the line above > > char [...] tty[5 + UT_LINESIZE + 1] = "/dev/"; > > does cause gcc to fill the all after /dev/ with \0 > So it does! (gdb) p tty $1 = "/dev/", '\000' <repeats 32 times> That's a GCC being clever thing? I would have thought the default behaviour would be /dev/\0(random stuff). It always breaks before UT_LINESIZE so its always going to have that \0 at the end. You can't have a line longer than the maximum so theres no issue of tty being reused through the loop either. - Craig --00000000000043ce1006238f2159 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Mon, 30 Sept 2024 at 19:21, Dr. Werner= Fink <<a href=3D"mailto:[email protected]">[email protected]</a>> wrote:</= div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"m= argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex">but AFAICR the line above<br> <br> =C2=A0 =C2=A0 char [...] tty[5 + UT_LINESIZE + 1] =3D "/dev/";<br= > <br> does cause gcc to fill the all after /dev/ with \0<br></blockquote><div>So = it does!</div><div>(gdb) p tty<br>$1 =3D "/dev/", '\000' = <repeats 32 times></div><div>That's a GCC being clever thing? I w= ould have thought the default behaviour would be /dev/\0(random stuff).<br>= </div><div><br></div><div>It always breaks before UT_LINESIZE so its always= going to have that \0 at the end.</div><div>You can't have a line long= er than the maximum so theres no issue of tty being reused through the loop= either.</div><div><br></div><div>=C2=A0- Craig</div><br></div></div> --00000000000043ce1006238f2159--