c - system function flaws -
we using c in linux. there possibility system() function can behave in unexpected manner, when handle signals?
we found sometimes, system() function blocks execution or throws sigsegv.
e.g:
system ( "/bin/mv b" ); are there known flaws in using system() explain this?
the system() function supposed well. behaviour pretty reliable long invoked correctly. has 2 modes of operation:
- check whether there command interpreter available - when argument null pointer.
- run command given, waiting command complete before returning.
so, system() statement blocks until shell runs command completes. on unix-like systems, command invoked effectively:
"sh", "-c", "...argument system...", null this means string passed interpreted shell. how long takes depends on command executed. can consider using shell notations run command in background if need to:
system("( /bin/mv b & )"); there few circumstances system() generate sigsegv. have pass invalid pointer, pointer somewhere invalid in program.
Comments
Post a Comment