Fix bug related to current working dir and allow writes

Allow writes due to "save copy" functionality and
also to save settings.
This commit is contained in:
Albert S. 2019-12-07 23:55:11 +01:00
parent 8dcd1d7090
commit 873a541729
2 changed files with 5 additions and 4 deletions

2
qssb.h

@ -1 +1 @@
Subproject commit 754764401368048dcdba39e153eb00f1f3c39898 Subproject commit 60776be4160fe7e2178b3790cd43a76d412843b6

View File

@ -472,7 +472,7 @@ int main(int argc, char** argv)
//break it? only allow "reasonable" paths? (which would that be?) //break it? only allow "reasonable" paths? (which would that be?)
struct qssb_path_policy root_policy; struct qssb_path_policy root_policy;
root_policy.mountpoint = "/"; root_policy.mountpoint = "/";
root_policy.policy = QSSB_MOUNT_ALLOW_READ | QSSB_MOUNT_ALLOW_EXEC; root_policy.policy = QSSB_MOUNT_ALLOW_READ | QSSB_MOUNT_ALLOW_EXEC | QSSB_MOUNT_ALLOW_WRITE;
root_policy.next = &data_dir_policy; root_policy.next = &data_dir_policy;
data_dir_policy.mountpoint = data_dir; data_dir_policy.mountpoint = data_dir;
@ -484,6 +484,8 @@ int main(int argc, char** argv)
config_dir_policy.next = NULL; config_dir_policy.next = NULL;
policy->path_policies = &root_policy; policy->path_policies = &root_policy;
char *cwd = get_current_dir_name();
policy->chdir_path = cwd;
//a pdfreader has no business accessing the network //a pdfreader has no business accessing the network
policy->namespace_options |= QSSB_UNSHARE_NETWORK; policy->namespace_options |= QSSB_UNSHARE_NETWORK;
@ -493,8 +495,7 @@ int main(int argc, char** argv)
return 1; return 1;
} }
free(cwd);
qRegisterMetaType< QList< QRectF > >("QList<QRectF>"); qRegisterMetaType< QList< QRectF > >("QList<QRectF>");
qRegisterMetaType< Rotation >("Rotation"); qRegisterMetaType< Rotation >("Rotation");
qRegisterMetaType< RenderParam >("RenderParam"); qRegisterMetaType< RenderParam >("RenderParam");