提交 d815efca 编写于 作者: M Max Reitz 提交者: Kevin Wolf

file-posix: Fix creation locking

raw_apply_lock_bytes() takes a bit mask of "permissions that are NOT
shared".

Also, make the "perm" and "shared" variables uint64_t, because I do not
particularly like using ~ on signed integers (and other permission masks
are usually uint64_t, too).
Reported-by: NKevin Wolf <kwolf@redhat.com>
Signed-off-by: NMax Reitz <mreitz@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 1dce698e
......@@ -2112,7 +2112,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
{
BlockdevCreateOptionsFile *file_opts;
int fd;
int perm, shared;
uint64_t perm, shared;
int result = 0;
/* Validate options and set default values */
......@@ -2148,7 +2148,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
/* Step one: Take locks */
result = raw_apply_lock_bytes(fd, perm, shared, false, errp);
result = raw_apply_lock_bytes(fd, perm, ~shared, false, errp);
if (result < 0) {
goto out_close;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册