On Tue, Mar 22, 2005 at 04:59:40PM +0100, Pierre Pronchery wrote:
> Package: wmmount
> Version: 1.0beta2-6
> Severity: wishlist
> Tags: patch
>
> Commands currently defined through "opencmd" are exec'd using execv(),
> thus ignoring the user's PATH environment. This is even more confusing
> since the supplied configuration files samples call "kfmclient" directly
> for instance.
>
> Please find attached my trivial patch for this problem. It also calls
> perror() when exec() would fail.
> --- wmmount-1.0beta2/wmmount.c 2005-03-22 16:53:43.000000000 +0100
> +++ wmmount-1.0beta2.khorben/wmmount.c 2005-03-22 16:53:29.000000000
> +0100
> @@ -863,7 +863,8 @@
> if(pid==0) {
> if(path!=NULL)
> chdir(path);
> - execv(argv[0], argv);
> + execvp(argv[0], argv);
> + perror(argv[0]);
> free(argv);
> free(buf);
> exit(127);
I guess using execvp is okay - I don't see much of a difference, the p
version is simply more convenient and has little overhead.
However, chdir() could also fail and set errno, and then perror would use
the wrong prefix. Why not run it conditionally?
--
2. That which causes joy or happiness.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]