Re: Warning with execvp

From: Sergei Organov (osv_at_javad.ru)
Date: 03/29/05


Date: 29 Mar 2005 16:21:55 +0400

tingashilo@yahoo.com writes:
> So trivial it's amazing I didn't see this option earlier.

Yes, but make sure not to call your routine with 'char const*'
arguments, for example, a call

        SWExec("the_executable", "an_argument");

results in undefined behavior. If the_executable will try to modify its
arguments (that's an allowed action for an executable), it most probably
will result in segmentation fault.

Also, from definition of your SWExec() it's unclear how do you know how
many arguments has been passed to the routine.

-- 
Sergei.


Relevant Pages

  • Re: Why is the pointer passed into the function still NULL?
    ... The routine can modify those named parameters, ... void get_table (char ** table) { ...
    (comp.lang.c)
  • Re: why the usage of gets() is dangerous.
    ... routine receives a char, and answere with 'this is lower case'. ... Assuming the original data is a string, the calling routine will ... No, a pointer to char was passed, and that is a pointer to a byte within a larger object. ... So go back to DOS because the memory protection in Windows does not work all the time, get rid of lifeboats from cruise ships because sometimes they fail and so on. ...
    (comp.lang.c)
  • Exception raised in GCI subroutine: Access Violation
    ... The routine aborts with an 'Exception raised inGCIsubroutine: ... int (since theGCIwon't support BOOL) ... I char* ... I BOOL (ditto) ...
    (comp.databases.pick)
  • Re: SSH on armv5tel: "You dont exist, go away!"
    ... same routine provided by BusyBox is working correctly but when a call ... int main(int argc, char **argv) ... If you run ./getpwuidtest, you should see what goes wrong with getpwuid. ... BusyBox, like almost every linux binary, is almost certainly also compiled against glibc on your system (confirm this with "ldd ...
    (comp.security.ssh)
  • Re: Why Case Sensitive?
    ... Now I could write a custom routine that would parse the options and extract the filenames. ... char *ramaangleset; ... However normally I would expect to control the options format myself. ...
    (comp.lang.c)