NFSv4: Use nfs->mask when create the default mode for open(O_CREAT)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2017-08-06 18:57:55 +10:00
parent 65a0110476
commit efb21535ab
3 changed files with 7 additions and 3 deletions

View File

@ -973,7 +973,8 @@ int
nfs_open_async(struct nfs_context *nfs, const char *path, int flags,
nfs_cb cb, void *private_data)
{
return nfs_open2_async(nfs, path, flags, 0, cb, private_data);
return nfs_open2_async(nfs, path, flags, 0666 & ~nfs->mask,
cb, private_data);
}
int

View File

@ -1864,7 +1864,7 @@ nfs4_open_async(struct nfs_context *nfs, const char *orig_path, int flags,
return -1;
}
*d = mode;
*d = htonl(mode);
data->filler.blob2.val = d;
data->filler.blob2.len = 4;

View File

@ -7,9 +7,12 @@ echo "NFSv${VERS} Open(O_CREAT) test."
start_share
echo -n "test open(O_RDWR|O_CREAT) (1) ... "
./prog_open_write "${TESTURL}/?version=${VERS}" "." /open1 O_WRONLY,O_CREAT "LordOfCinder" >/dev/null || failure
./prog_open_write "${TESTURL}/?version=${VERS}" "." /create1 O_WRONLY,O_CREAT LordOfCinder >/dev/null || failure
success
echo -n "Verify the file content ... "
grep LordOfCinder "${TESTDIR}/create1" >/dev/null || failure
success
stop_share