Re: system command returning unknown error.
Re: system command returning unknown error.
- Subject: Re: system command returning unknown error.
- From: "matt jaffa" <email@hidden>
- Date: Wed, 14 Jun 2006 13:35:02 -0600
Yes I am running as a root process.
On 6/14/06, John Francini <email@hidden> wrote:
/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:
> 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.
>
> soo I am getting 32256 by executing system("/sbin/shutdown -r
> now");
>
>
> On 6/14/06, John Francini <email@hidden
> wrote:
>> Rather than having people say "Yes, I did, No, I didn't", let's cut
>> the Gordian knot.
>>
>> The man page on 10.4.6 reads as follows:
>>
>> SYSTEM(3) BSD Library Functions Manual
>> SYSTEM(3)
>>
>> NAME
>> system -- pass a command to the shell
>>
>> LIBRARY
>> Standard C Library (libc, -lc)
>>
>> SYNOPSIS
>> #include <stdlib.h>
>>
>> int
>> system(const char *string);
>>
>> DESCRIPTION
>> The system() function hands the argument string to the command
>> inter-
>> preter sh(1). The calling process waits for the shell to
>> finish execut-
>> ing the command, ignoring SIGINT and SIGQUIT, and blocking
>> SIGCHLD.
>>
>> If string is a NULL pointer, system() will return non-zero if
>> the command
>> interpreter sh(1) is available, and zero if it is not.
>>
>> The system() function returns the exit status of the shell as
>> returned by
>> waitpid(2), or -1 if an error occurred when invoking fork(2) or
>> waitpid(2). A return value of 127 means the execution of the
>> shell
>> failed.
>>
>> SEE ALSO
>> sh(1), execve(2), fork(2), waitpid(2), popen(3)
>>
>> STANDARDS
>> The system() function conforms to ISO/IEC 9899:1990 (``ISO
>> C90'') and is
>> expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
>>
>> BSD June 4,
>> 1993 BSD
>>
>> Given this, your error of 32256 is being generated by the shell --
>> meaning the command you ran exited with that status.
>>
>> It might be more helpful if you can give a concise example of the
>> specific code that is failing.
>>
>> John Francini
>>
>>
>>
>>
>>
>> On 14 Jun 2006, at 14:12, Matthew Jaffa wrote:
>>
>> > Yes I read the man page, and it says -1 if not successful, 0 if
>> > successful, and returns non-zero if the command you pass in is
>> > NULL, but I know I didn't pass in null cause I log it right before
>> > I execute the command.
>> >
>> > Matt
>> >
>> >
>> >> From: "Justin C. Walker" <
email@hidden>
>> >> To: "email@hidden list" <email@hidden
>
>> >> Subject: Re: system command returning unknown error.
>> >> Date: Wed, 14 Jun 2006 10:38:46 -0700
>> >>
>> >>
>> >> On Jun 14, 2006, at 10:30 , matt jaffa wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> I am calling system(char* command) in my .cpp file. But this is
>> >>> returning
>> >>> error 32256. This error no. is not documented so I don't know
>> >>> why it is not
>> >>> working.
>> >>> Anyone seen this error number before and know what it means.
>> >>
>> >> Did you read the man page for the 'system()' call?
>> >>
>> >> Regards,
>> >>
>> >> Justin
>> >>
>> >> --
>> >> Justin C. Walker, Curmudgeon at Large
>> >> Director
>> >> Institute for the Enhancement of the Director's Income
>> >> -----------
>> >> Nobody knows the trouble I've been
>> >> -----------
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> Do not post admin requests to the list. They will be ignored.
>> >> Darwin-dev mailing list (
>> >
>> >
>> > _______________________________________________
>> > Do not post admin requests to the list. They will be ignored.
>> > Darwin-dev mailing list (
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-dev mailing list (
>>
>> This email sent to email@hidden
>>
_______________________________________________
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