Sure, I've added some checks for open/dup2 (and exiting the child).
On execl, I've kept the similar logic than the rest of the code, meaning:
- don't check for execl return value.
- if something bad happen, execl returns.
- we go on the next line which is a perror() + exit.
On the strrstr(), I found it more clear than the offset and future-proof than hardcoding *pname. I don't have a strong opinion though TBH, so I have just hardcoded "zsys" directly as you suggested.
Hey Alex! Thanks for looking at it.
Sure, I've added some checks for open/dup2 (and exiting the child).
On execl, I've kept the similar logic than the rest of the code, meaning:
- don't check for execl return value.
- if something bad happen, execl returns.
- we go on the next line which is a perror() + exit.
On the strrstr(), I found it more clear than the offset and future-proof than hardcoding *pname. I don't have a strong opinion though TBH, so I have just hardcoded "zsys" directly as you suggested.
I've attached a new version of the patch.