site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jan 27, 2008, at 12:12 AM, Peter Seebach wrote: if (chdir(auto_qmail) == -1) _exit(61); execv(*binqqargs,binqqargs); _exit(120); 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; } -- Steve Checkoway "Anyone who says that the solution is to educate the users hasn't ever met an actual user." -- Bruce Schneier _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com In message <479C20CF.1080900@yahoo.com>, Steve writes: Calling _exit from user code is nearly always a mistake. This is not true at all. If you call fork(2) and a subsequent exec* fails, then you must call _exit(2). exit(3) calls functions registered with atexit, flushes open output streams, closes open streams, and unlinks files created with tmpfile(3).Calling exit(3) will cause the open output streams to flush twice. So, the chdir on all other platforms goes to /var/qmail, and, the execv executes from there bin/qmail-queue. So the program you want to execute is /var/qmail/bin/qmail-queue? Seems like a strange place for it. You're assigning a const char * to a char *. I'm not sure why gcc doesn't warn about this, but I suspect that it should. In fact, if you assign "bin/ls" to a const char * first, then it does warn, "warning: assignment discards qualifiers from pointer target type." That said, execv(3) works for me without an absolute path as well. smime.p7s
participants (1)
-
Steve Checkoway