# HG changeset patch # User Rob Landley # Date 1215953869 18000 # Node ID f9ec1fd54034299f4ce86c41cbf863361f3239bb # Parent a9dfcdc8de35805a63e1870bba6a3c74f592ba14 Correct log message, check last $PATH element properly, and set argv[0] to path being run and not just command name. diff -r a9dfcdc8de35 -r f9ec1fd54034 sources/toys/wrappy.c --- a/sources/toys/wrappy.c Sat Jul 12 00:36:50 2008 -0500 +++ b/sources/toys/wrappy.c Sun Jul 13 07:57:49 2008 -0500 @@ -81,18 +81,21 @@ // Hand off control to the real executable - for (p = p3 = realpath; *p3; p3++) { + for (p = p3 = realpath; ; p3++) { if (*p3==':' || !*p3) { char snapshot = *p3; + *p3 = 0; snprintf(blah, sizeof(blah)-1, "%s/%s", p, p2); *p3 = snapshot; + argv[0]=blah; execve(blah, argv, env); + if (!*p3) break; p = p3+1; } } // Should never happen, means environment setup is wrong. - fprintf(stderr, "Didn't find %s\n", logpath); + fprintf(stderr, "Didn't find %s\n", p2); exit(1); }