On Jul 13, 2016, at 2:25 PM, Sebastian Lackner sebastian@fds-team.de wrote:
On 13.07.2016 20:20, Ken Thomases wrote:
Moving the code to the bottom could be done, although it would mean two #ifdef HAVE_SETPROCTITLE blocks, one to set shift_strings and the other to actually make the call. The reason is that the shifting has to happen before the call to setprogname() because it's documented to keep the pointer that's passed in. We can't pass it (a substring of) argv[1] and then shift the strings.
I'm not sure if two #ifdefs is actually that bad, it probably should depend on the operating system anyway.
By "it" you mean the decision to shift the strings? Why should that depend on the OS? What reliable way do we have to detect if the OS works that way other than the strings actually being contiguous?
On systems where it doesn't make a difference (like FreeBSD, ...) this step can always be safely skipped.
By "systems where it doesn't make a difference", you mean those that have setproctitle()? By "this step" you mean shifting the strings? That's what my patch already does.
In other words, I don't understand what you're getting at with this paragraph.
-Ken