C's pointer arithmetic (Was Re: Setting effective UID for a shell script)

2002-05-16 Thread Perceval Anichini
>>>execv( argv[1], argv + sizeof( argv[1] ) ); >> Could you explain this? Why would this line be *more* correct than the precedent? > The second version makes the pointer arithmetic explicit and has the > correct type for the second argument. The first involves an implicit > cast from char*

Re: Setting effective UID for a shell script

2002-05-15 Thread perceval anichini
> correct, the call should be: >execv( argv[1], argv[2] ); > For the fanatically correct, this might be better: >execv( argv[1], argv + sizeof( argv[1] ) ); Could you explain this? Why would this line be *more* correct than the precedent? Moreover, argv + sizeof (argv[1]) is equ