site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jun 14, 2006, at 12:48 PM, "matt jaffa" <mjaffa@gmail.com> wrote: Yes I am running as a root process. /sbin/shutdown must be run by root. Running as a user with Administrator privilege is not sufficient. Is the parent process running as root or setuid to root? John On 14 Jun 2006, at 15:15, matt jaffa wrote: soo I am getting 32256 by executing system("/sbin/shutdown -r now"); Matt, It's a very good thing that you are getting this error. = Mike _______________________________________________ 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... On 6/14/06, John Francini <francini@mac.com> wrote: Ok so I admit I read it wrong regarding the return status, always got 0 for everything else I executed so I assumed 0 good and only -1 was returned if bad. You should not be calling system(3), and most especially you should not be calling it from a process running as root. Please consult your copy of "Advanced Programming in the Unix Environment" by W. Richard Stevens, and see his straightforward examples on the correct usage of fork(2) and execv (2), which will do what you want just fine. Incidentally, unless you are shutting the system down in an emergency, invoking shutdown(8) may not be the correct way to bring the system down. It's definitely not polite to any currently-logged- in console user. This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Smith