[CRIU] Re: [PATCH v2] show: logic for optionaly files introduced

Pavel Emelyanov xemul at parallels.com
Wed Feb 8 07:51:28 EST 2012


Лучше так:

-struct cr_fdset *prep_cr_fdset_for_restore(int pid, unsigned long use_mask)
-struct cr_fdset *cr_fdset_open(int pid, unsigned long use_mask, struct cr_fdset *cr_fdset)
+struct cr_fdset *cr_fdset_open(int pid, unsigned long use_mask,
+		unsigned int flags, struct cr_fdset *cr_fdset)

А внутри так:

-	ret = open(path, O_RDWR | O_CREAT | O_EXCL, CR_FD_PERM);
+	ret = open(path, flags, CR_FD_PERM);
	if (ret < 0) {
+		if (!(flags & O_CREAT))
+			/* caller should check himself */
+			fdset->fds[i] = -1;
+			continue;
+		}
+
		pr_perror("Unable to open %s", path);
		goto err;
	}



More information about the CRIU mailing list