[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.00.0901301453190.29805@fbirervta.pbzchgretzou.qr>
Date: Fri, 30 Jan 2009 14:56:37 +0100 (CET)
From: Jan Engelhardt <jengelh@...ozas.de>
To: Nathanael Hoyle <nhoyle@...letech.com>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: scheduler nice 19 versus 'idle' behavior / static low-priority
scheduling
On Friday 2009-01-30 09:16, Nathanael Hoyle wrote:
><snipped old version, because of a fixed goof, and this has better
>formatting for mail client>
>
>extern char **environ;
>[...]
> if(argc==2) {
> if(execve(argv[1], NULL, environ) == -1) {
> perror("Failed to execve target!");
> }
> } else {
> if(execve(argv[1], argv+1, environ) == -1) {
> perror("Failed to execve target!");
> }
> }
Are you sure your first execve even works? I would have used
if (execvp(argv[1], &argv[1]) < 0)
...
just so (a) I do not have to deal with the ugly 'extern char **environ'
[such should have been in a libc header imho] or use
int main(int argc, char **argv, char **envp); (b) execvp so that
it looks through $PATH, just as /bin/su (resp. the shell it starts) would do.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists