mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +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:
16
files.c
16
files.c
@@ -267,12 +267,18 @@ static int open_transport_fd(int pid, struct fdinfo_list_entry *fle)
|
|||||||
flem = file_master(fle->desc);
|
flem = file_master(fle->desc);
|
||||||
|
|
||||||
if (flem->pid == pid) {
|
if (flem->pid == pid) {
|
||||||
if (flem->fe.fd == fle->fe.fd) {
|
if (flem->fe.fd != fle->fe.fd)
|
||||||
/* file master */
|
/* dup-ed file. Will be opened in the open_fd */
|
||||||
if (!should_open_transport(&fle->fe, fle->desc))
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
return 0;
|
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);
|
transport_name_gen(&saddr, &sun_len, getpid(), fle->fe.fd);
|
||||||
|
Reference in New Issue
Block a user