From a49eb5920006668ae7c8037cc95ccd3e438f5938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= Date: Sat, 11 Nov 2023 12:03:03 -0500 Subject: [PATCH] xdg-document-portal: implement setlk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed for things like sqlite3 See https://github.com/flatpak/xdg-desktop-portal/issues/1117 Signed-off-by: Hubert Figuière --- document-portal/document-portal-fuse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/document-portal/document-portal-fuse.c b/document-portal/document-portal-fuse.c index 19ba4701a..dc4bd5fdb 100644 --- a/document-portal/document-portal-fuse.c +++ b/document-portal/document-portal-fuse.c @@ -3130,10 +3130,16 @@ xdp_fuse_setlk (fuse_req_t req, int sleep) { const char *op = "SETLK"; + XdpFile *file = (XdpFile *)fi->fh; + int res; g_debug ("SETLK %lx", ino); - xdp_reply_err (op, req, ENOSYS); + res = fcntl (file->fd, F_SETLK, lock); + if (res == 0) + return xdp_reply_err (op, req, 0); + else + return xdp_reply_err (op, req, errno); } static void