Skip to content

Fail early, fail hard.#1676

Draft
alejandro-colomar wants to merge 14 commits into
shadow-maint:masterfrom
alejandro-colomar:fgets
Draft

Fail early, fail hard.#1676
alejandro-colomar wants to merge 14 commits into
shadow-maint:masterfrom
alejandro-colomar:fgets

Conversation

@alejandro-colomar

@alejandro-colomar alejandro-colomar commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

@alejandro-colomar alejandro-colomar self-assigned this Jul 14, 2026
@alejandro-colomar
alejandro-colomar force-pushed the fgets branch 2 times, most recently from 6c5af21 to 8915861 Compare July 14, 2026 17:59
@alejandro-colomar
alejandro-colomar marked this pull request as draft July 14, 2026 18:32
CST6CDT seems to be a deprecated name, and also it feels weird to have
an offset by default.  The world defaults to UTC these days for most
stuff.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
We set 'fp' unconditionally with the result of fopen(3).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
'buf' instead of 'tzbuf', since it's a more common name.

'fname' => 'path', since it represents a path name, and not just a file
component.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
While at it, remove unused includes.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This minimizes the risk of misbehaving.

Fixes: 45c6603 (2007-10-07; "[svn-upgrade] Integrating new upstream version, shadow (19990709)")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This is a clean-up after the last commit.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
The '\n' necessarily ends the string, so strprefix() makes little sense.
Also, while at it, use strspn(3) instead of strprefix() for '#'.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Files that don't end in a newline character are not POSIX text files,
and thus invalid input.  Let's reject them.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant