Re: execv bug???
Re: execv bug???
- Subject: Re: execv bug???
- From: email@hidden (Peter Seebach)
- Date: Sun, 27 Jan 2008 02:12:20 -0600
In message <email@hidden>, Steve writes:
>Have a well known program, qmail, compiled on Leopard. We've used it for
>3 years or so on Mac Tiger et al.
I would suggest switching to postfix. qmail is unmaintained, and while
no one would accuse djb's code of being a forest of security holes, it's not
exactly written with an aggressive eye to language standards or portability.
>qmail runs on most any platform out there. In the code, are the
>following lines:
> if (chdir(auto_qmail) == -1) _exit(61);
> execv(*binqqargs,binqqargs);
> _exit(120);
Calling _exit from user code is nearly always a mistake.
>So, the chdir on all other platforms goes to /var/qmail, and, the execv
>executes from there bin/qmail-queue.
Makes sense.
>The execv (added more code) returns an error 2, or, file not found on
>Leopard.
That's odd. I'd probably replace it with "/bin/pwd" and see what it says. :)
>Could it be a bug in execv on Leoprd when when not using a absolute
>filename?
No, because as a simple test program shows, that works:
static char *ev[] = { 0, 0 };
int
main(void) {
ev[0] = "bin/ls";
chdir("/");
execv(*ev, ev);
return 23;
}
This will run ls and return 0, suggesting that execv can handle non-absolute
path names.
Conclusion: Something else has gone wrong.
To debug this, you'd presumably need to add all sorts of extra debugging
code, possibly instrumenting libc (as I think execv may be implemented
in terms of one of the other exec syscalls), etcetera.
I wouldn't bother; postfix is better anyway.
-s
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden