Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: execv bug???



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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >execv bug??? (From: Steve <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.