News for hackers. Stuff that matters.
Re:Unix's special way of marking login shells goes back to V... by saagarjha on Sunday December 11, 2022 @08:37AM (#33943035)
argv[0] is independent of the executable path. In fact there’s a common “trick” on Unix systems where you offer one binary and it figures out what it is supposed to be by peeking at argv[0]. Also, you’re allowed to freely modify argv, so if anyone reads it by scanning your stack it’ll get the new value.
Re:Unix's special way of marking login shells goes back to V... by bonzini on Sunday December 11, 2022 @09:12AM (#33943337)
But that trick is usually done with symbolic links, so in that case argv[0] _is_ related to the executable path.
Re:Unix's special way of marking login shells goes back to V... by jmmv on Sunday December 11, 2022 @10:55AM (#33944227)
Hard links, not symbolic links.
Re:Unix's special way of marking login shells goes back to V... by rollcat on Sunday December 11, 2022 @11:13AM (#33944414)
Either works.
Re:Unix's special way of marking login shells goes back to V... by saagarjha on Sunday December 11, 2022 @10:30AM (#33943971)
True.