2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

files: Sanitize transport creation

Current if/if/else scheme is ... not so easy to understand. Here's an
attempt to make it more readable. Bonus: free comments.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-06-04 00:23:49 +04:00
parent 3d24b7d54e
commit 57b1e94522

16
files.c
View File

@@ -267,12 +267,18 @@ static int open_transport_fd(int pid, struct fdinfo_list_entry *fle)
flem = file_master(fle->desc);
if (flem->pid == pid) {
if (flem->fe.fd == fle->fe.fd) {
/* file master */
if (!should_open_transport(&fle->fe, fle->desc))
return 0;
} else
if (flem->fe.fd != fle->fe.fd)
/* dup-ed file. Will be opened in the open_fd */
return 0;
if (!should_open_transport(&fle->fe, fle->desc))
/* pure master file */
return 0;
/*
* some master file, that wants a transport, e.g.
* a pipe or unix socket pair 'slave' end
*/
}
transport_name_gen(&saddr, &sun_len, getpid(), fle->fe.fd);