-
Notifications
You must be signed in to change notification settings - Fork 254
lib/utmp.c: is_my_tty(): Simplify #1376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/utmp.c: is_my_tty(): Simplify #1376
Conversation
f68a208 to
568527e
Compare
b4a9595 to
be26914
Compare
3c46edb to
993fc4e
Compare
|
I know it doesn't affect the end result, but patch two can't compile because you didn't change all instances of the ttyname variable. |
Oops, my bad. Thanks! Will fix. |
993fc4e to
2fc993a
Compare
Done. Thanks! (I suspect it was the result of reordering commits.) |
The method for checking for truncation was quite weird. By not caching ttyname(3), we use it directly, without needing a temporary copy, which removes opportunities for bugs. Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
This name makes the function definition more readable. Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
And use it instead of its pattern. This macro enforces correct use of ttyname_r(3) with arrays. Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2fc993a to
7d02a22
Compare
Let's keep it simple.
Revisions:
v2
v2b