Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: srand(0) Date: Wed, 31 Dec 2025 15:17:22 -0800 Organization: None to speak of Lines: 23 Message-ID: <87tsx6utq5.fsf@example.invalid> References: <10ib0ka$3cgil$1@dont-email.me> <10idg5m$3k87$3@dont-email.me> <20251224105114.0000714b@yahoo.com> <10ih0qo$13hnn$2@dont-email.me> <20251224174452.00003278@yahoo.com> <10ih3lu$13hnn$5@dont-email.me> <10ih5r2$25ihh$5@dont-email.me> <10iiell$1kfhj$1@dont-email.me> <10iirh8$25ihh$6@dont-email.me> <10ilfqp$2fs21$1@dont-email.me> <10ivq6b$1j8r3$1@dont-email.me> <10j206j$27s3j$1@dont-email.me> <10j247s$2925s$3@dont-email.me> <87fr8rwccq.fsf@example.invalid> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 31 Dec 2025 23:17:23 +0000 (UTC) Injection-Info: dont-email.me; posting-host="eea1bd566f7c70dcb85fabb9ef2f06cf"; logging-data="3106480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yZ9NzDawQ3/FloJWSV/BI" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:v2JVxTRq9J4yksI6fTprh3rreZc= sha1:AQJCRCRrID9ZtGK7fwkPhR06De4= Xref: csiph.com comp.lang.c:396043 scott@slp53.sl.home (Scott Lurndal) writes: > Keith Thompson writes: [...] >>That's not clear. Linux (since 2022) guarantees argc>=1. > > Does it? That seems to be up to the shell, since the exec() > manual pages on the latest Fedora Core release don't indicate > that argv[0] must be initialized or that argc be greater than zero. As I understand it, all the exec() functions go through the execve() system call. In 2022, the Linux kernel execve() implementation was modified to guarantee that argc>0 and argv[0]!=NULL in the invoked program. A shell presumably can't bypass that. commit dcd46d897adb70d63e025f175a00a89797d31a43 Author: Kees Cook Date: 2022-01-31 16:09:47 -0800 exec: Force single empty string when argv is empty -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */