• Cyrill Gorcunov's avatar
    crtools: Make fdset operations robust against open() errors · 7705df53
    Cyrill Gorcunov authored
    There are two cases for cr_fdset_open
    
     - It might be called with already allocated
       memory so we should reuse it.
    
     - It might be called with NULL pointing out
       that caller expects us to allocate memory.
    
    If an open() error happens somewhere inside cr_fdset_open
    it requires two error paths
    
     - Just close all files opened but don't free memory
       if it was not allocated by us
    
     - Close all files opened *and* free memory allocated
       by us.
    
    In any case we should close all files opened so close_cr_fdset()
    helper is splitted into two parts.
    
    Also the caller should be ready for such semantics as well and
    do not re-assign pointers obtained but simply test for NULL
    on results.
    Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    7705df53
Name
Last commit
Last update
Documentation Loading commit data...
include Loading commit data...
test Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
COPYING Loading commit data...
Makefile Loading commit data...
Makefile.inc Loading commit data...
README Loading commit data...
cr-dump.c Loading commit data...
cr-restore.c Loading commit data...
cr-show.c Loading commit data...
crtools.c Loading commit data...
files.c Loading commit data...
gen-offsets.sh Loading commit data...
libnetlink.c Loading commit data...
log.c Loading commit data...
namespaces.c Loading commit data...
parasite-syscall.c Loading commit data...
parasite.c Loading commit data...
parasite.lds.S Loading commit data...
proc_parse.c Loading commit data...
ptrace.c Loading commit data...
restorer-log.c Loading commit data...
restorer.c Loading commit data...
restorer.lds.S Loading commit data...
sockets.c Loading commit data...
util.c Loading commit data...
uts_ns.c Loading commit data...