* of the GNU Lesser General Public License.
*/
-#include "ucw/lib.h"
+#include <ucw/lib.h>
+#include <ucw/process.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
+#include <errno.h>
static char **spt_argv;
static char *spt_start, *spt_end;
for (i=0; oldenv[i]; i++)
if (spt_end+1 == oldenv[i])
spt_end = oldenv[i] + strlen(oldenv[i]);
+
+ /* Copy all arguments */
+ for (i=0; i<argc; i++)
+ argv[i] = xstrdup(argv[i]);
+
+ /* Recalculate program_invocation_name, otherwise syslog() will be confused. */
+ char *name = argv[0];
+ program_invocation_name = name;
+ char *p = strrchr(name, '/');
+ if (p)
+ program_invocation_short_name = p + 1;
+ else
+ program_invocation_short_name = name;
#endif
}